CapyKit/Docs/api/CapyKit.Extensions.EnumerationExtensions.md

4.9 KiB

Class EnumerationExtensions

Namespace: CapyKit.Extensions
Assembly: CapyKit.dll

Provides static extentions methods for providing additional functionality for types.

public static class EnumerationExtensions

Inheritance

objectEnumerationExtensions

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Extension Methods

ObjectExtensions.UpdateProperties(object, object)

Methods

GetDescription(Enum)

An extension method that gets a description.

public static string GetDescription(this Enum enumeration)

Parameters

enumeration Enum

The enumeration to act on.

Returns

string

The description if available, otherwise the string representation of the enumeration.

GetName(Enum)

An extension method that gets a name.

public static string GetName(this Enum enumeration)

Parameters

enumeration Enum

The enumeration to act on.

Returns

string

The name of the enumeration.

GetPrettyName(Enum)

An extension method that gets a human readable name.

public static string GetPrettyName(this Enum enumeration)

Parameters

enumeration Enum

The enumeration to act on.

Returns

string

The human readable name of the enumeration.

GetValue(Enum)

An extension method that gets an integer value representing the enumation.

public static int GetValue(this Enum enumeration)

Parameters

enumeration Enum

The enumeration to act on.

Returns

int

The integer value of the enumeration.

Parse<T>T, string

A T extension method that parses a string into an enumeration.

public static T Parse<T>(this T enumeration, string value) where T : Enum

Parameters

enumeration T

The enumeration to act on.

value string

The value.

Returns

T

A T.

Type Parameters

T

Generic type parameter.

Parse<T>T, string, bool

A T extension method that parses a string into an enumeration.

public static T Parse<T>(this T enumeration, string value, bool ignoreCase) where T : Enum

Parameters

enumeration T

The enumeration to act on.

value string

The string value of the .

ignoreCase bool

True to ignore case.

Returns

T

A T.

Type Parameters

T

Generic type parameter.