Class EnumExtensions
Inheritance
System.Object
EnumExtensions
Assembly: Emby.Media.Model.dll
public static class EnumExtensions
Methods
Creates a LevelInformation object for codec level enum members based on attributes defined for this member.
Declaration
public static LevelInformation CreateLevelInformation(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Creates a ProfileInformation object for codec profile enum members based on attributes defined for this member.
Declaration
public static ProfileInformation CreateProfileInformation(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Declaration
public static T? EnumFromAlias<T>(string value)
where T : struct, Enum
Parameters
Type |
Name |
Description |
System.String |
value |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
Declaration
public static T? EnumFromStringOrAlias<T>(string value)
where T : struct, Enum
Parameters
Type |
Name |
Description |
System.String |
value |
|
Returns
Type |
Description |
System.Nullable<T> |
|
Type Parameters
Declaration
public static List<T> EnumListFromStringOrAlias<T>(string value, params char[] splitChars)
where T : struct, Enum
Parameters
Type |
Name |
Description |
System.String |
value |
|
System.Char[] |
splitChars |
|
Returns
Type |
Description |
System.Collections.Generic.List<T> |
|
Type Parameters
Finds members of a specified enum that are having the specified mime type defined in by a MimeTypesAttribute.
Declaration
public static IList<T> FindByMimeType<T>(this T enumType, string mimeType)
where T : Enum
Parameters
Type |
Name |
Description |
T |
enumType |
Type of the enum to search.
|
System.String |
mimeType |
Mime type to search for.
|
Returns
Type |
Description |
System.Collections.Generic.IList<T> |
|
Type Parameters
Finds members of a specified enum that are having the specified related Guid type defined in by a RelatedGuidAttribute.
Declaration
public static IList<T> FindByRelatedGuid<T>(this T enumType, Guid relatedGuid)
where T : Enum
Parameters
Type |
Name |
Description |
T |
enumType |
Type of the enum to search.
|
System.Guid |
relatedGuid |
Related Guid to search for.
|
Returns
Type |
Description |
System.Collections.Generic.IList<T> |
|
Type Parameters
Declaration
public static IList<string> GetAliases(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
|
Returns
Type |
Description |
System.Collections.Generic.IList<System.String> |
|
Declaration
public static int? GetBitDepth(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.Nullable<System.Int32> |
|
Declaration
public static List<int> GetBitDepths(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.Collections.Generic.List<System.Int32> |
|
Declaration
public static BitRate? GetBitRate(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.Nullable<BitRate> |
|
Declaration
public static int? GetBitsPerPixel(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.Nullable<System.Int32> |
|
Declaration
public static int? GetChannelCount(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.Nullable<System.Int32> |
|
Gets the content of an enum member's System.ComponentModel.DescriptionAttribute, or its name in case there is none.
Declaration
public static string GetDescription(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.String |
|
Gets the content of an enum member's DetailsAttribute, or null in case there is none.
Declaration
public static string GetDetails(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.String |
|
Gets an enum identifier like it would be used in code ('MyEnum.MyValue').
Declaration
public static string GetEnumId(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.String |
|
Gets the first alias or otherwise the name of the enum entry.
Declaration
public static string GetFirstAliasOrName(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.String |
A string.
|
Gets the first guid of an enum member's RelatedGuidAttribute, or System.Guid.Empty in case there is none.
Declaration
public static Guid GetFirstRelatedGuid(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.Guid |
|
Gets the value of an enum member's IdTagAttribute, or null in case there is none.
Declaration
public static string GetIdTag(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.String |
|
Declaration
public static bool GetIsGraphic(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
|
Returns
Type |
Description |
System.Boolean |
|
Declaration
public static bool GetIsHdr(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
|
Returns
Type |
Description |
System.Boolean |
|
Gets the first mime type of an enum member's MimeTypesAttribute, or null in case there is none.
Declaration
public static string GetMimeType(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.String |
|
Gets all mime types of an enum member's MimeTypesAttribute, or null in case there is none.
Declaration
public static IList<string> GetMimeTypes(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.Collections.Generic.IList<System.String> |
|
Gets the value of an enum member's OrdinalAttribute, or null in case there is none.
Declaration
public static int? GetOrdinal(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.Nullable<System.Int32> |
|
Declaration
public static IList<Guid> GetRelatedGuids(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.Collections.Generic.IList<System.Guid> |
|
Declaration
public static IList<ResolutionWithRate> GetResRates(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Gets the content of r the value property of an enum member's ValueAttribute, or null in case there is none.
Declaration
public static string GetValue(this Enum enumValue)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
Returns
Type |
Description |
System.String |
|
Declaration
public static bool IsAnyOf<T>(this T? value, params T[] list)
where T : struct, Enum
Parameters
Type |
Name |
Description |
System.Nullable<T> |
value |
|
T[] |
list |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
Checks whether an enum member supports a given bit depth (has a BitDepth attribute matching the provided bitDepth).
Declaration
public static bool SupportsBitDepth(this Enum enumValue, int bitDepth)
Parameters
Type |
Name |
Description |
System.Enum |
enumValue |
The enum value.
|
System.Int32 |
bitDepth |
The bit depth.
|
Returns
Type |
Description |
System.Boolean |
|