EnumExtensions
Assembly: ServiceStack.Common.dll
View Source
Declaration
public static class EnumExtensions
Methods
ToDescription(Enum)
Gets the textual description of the enum if it has one. e.g.
<pre><code>enum UserColors { [Description("Bright Red")] BrightRed } UserColors.BrightRed.ToDescription();</code></pre>
View Source
Declaration
public static string ToDescription(this Enum enum)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Enum | enum |
ToKeyValuePairs<T>(IEnumerable<T>)
View Source
Declaration
public static List<KeyValuePair<string, string>> ToKeyValuePairs<T>(this IEnumerable<T> enums)
where T : Enum
Returns
System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.String,System.String>>
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<<T>> | enums |
Type Parameters
T
ToList(Enum)
View Source
Declaration
public static List<string> ToList(this Enum enum)
Returns
System.Collections.Generic.List<System.String>
Parameters
Type | Name |
---|---|
System.Enum | enum |
GetTypeCode(Enum)
View Source
Declaration
public static TypeCode GetTypeCode(this Enum enum)
Returns
System.TypeCode
Parameters
Type | Name |
---|---|
System.Enum | enum |
Has<T>(Enum, T)
View Source
Declaration
public static bool Has<T>(this Enum enum, T value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Enum | enum |
<T> | value |
Type Parameters
T
Is<T>(Enum, T)
View Source
Declaration
public static bool Is<T>(this Enum enum, T value)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Enum | enum |
<T> | value |
Type Parameters
T
Add<T>(Enum, T)
View Source
Declaration
public static T Add<T>(this Enum enum, T value)
Returns
<T>
Parameters
Type | Name |
---|---|
System.Enum | enum |
<T> | value |
Type Parameters
T
Remove<T>(Enum, T)
View Source
Declaration
public static T Remove<T>(this Enum enum, T value)
Returns
<T>
Parameters
Type | Name |
---|---|
System.Enum | enum |
<T> | value |
Type Parameters
T