Class EnumerationExtensions
Provides static extentions methods for providing additional functionality for Enum types.
Namespace: CapyKit.Extensions
Assembly: CapyKit.dll
Syntax
public static class EnumerationExtensions
Methods
GetDescription(Enum)
An Enum extension method that gets a description.
Declaration
public static string GetDescription(this Enum enumeration)
Parameters
| Type | Name | Description |
|---|---|---|
| Enum | enumeration | The enumeration to act on. |
Returns
| Type | Description |
|---|---|
| string | The description if available, otherwise the string representation of the enumeration. |
GetName(Enum)
An Enum extension method that gets a name.
Declaration
public static string GetName(this Enum enumeration)
Parameters
| Type | Name | Description |
|---|---|---|
| Enum | enumeration | The enumeration to act on. |
Returns
| Type | Description |
|---|---|
| string | The name of the enumeration. |
GetPrettyName(Enum)
An Enum extension method that gets a human readable name.
Declaration
public static string GetPrettyName(this Enum enumeration)
Parameters
| Type | Name | Description |
|---|---|---|
| Enum | enumeration | The enumeration to act on. |
Returns
| Type | Description |
|---|---|
| string | The human readable name of the enumeration. |
GetValue(Enum)
An Enum extension method that gets an integer value representing the enumation.
Declaration
public static int GetValue(this Enum enumeration)
Parameters
| Type | Name | Description |
|---|---|---|
| Enum | enumeration | The enumeration to act on. |
Returns
| Type | Description |
|---|---|
| int | The integer value of the enumeration. |
Parse<T>(T, string)
A T extension method that parses a string into an enumeration.
Declaration
public static T Parse<T>(this T enumeration, string value) where T : Enum
Parameters
| Type | Name | Description |
|---|---|---|
| T | enumeration | The enumeration to act on. |
| string | value | The value. |
Returns
| Type | Description |
|---|---|
| T | A T. |
Type Parameters
| Name | Description |
|---|---|
| T | Generic type parameter. |
Parse<T>(T, string, bool)
A T extension method that parses a string into an enumeration.
Declaration
public static T Parse<T>(this T enumeration, string value, bool ignoreCase) where T : Enum
Parameters
| Type | Name | Description |
|---|---|---|
| T | enumeration | The enumeration to act on. |
| string | value | The string value of the Enum. |
| bool | ignoreCase | True to ignore case. |
Returns
| Type | Description |
|---|---|
| T | A T. |
Type Parameters
| Name | Description |
|---|---|
| T | Generic type parameter. |