Table of Contents

Class Enum_CB_Extension

Namespace
System
Assembly
Cobilas.Core.dll
public static class Enum_CB_Extension
Inheritance
Enum_CB_Extension
Inherited Members

Methods

Format(Enum, object, string)

Converts the specified value of a specified enumerated type to its equivalent string representation according to the specified format.

public static string Format(this Enum E, object value, string format)

Parameters

E Enum

The target enumerator.

value object

The value to convert.

format string

The output format to use.

Returns

string

A string representation of value.

Exceptions

ArgumentNullException

The enumType, value, or format parameter is null.

ArgumentException

The enumType parameter is not an Enum type. -or- The value is from an enumeration that differs in type from enumType. -or- The type of value is not an underlying type of enumType.

FormatException

The format parameter contains an invalid value.

InvalidOperationException

format equals "X", but the enumeration type is unknown.

GetEnumPair(Enum)

Gets the tag with the current assigned value.

public static KeyValuePair<string, int> GetEnumPair(this Enum E)

Parameters

E Enum

The target enumerator.

Returns

KeyValuePair<string, int>

GetEnumPairs(Enum)

Gets a list of all tags along with their assigned values.

public static KeyValuePair<string, int>[] GetEnumPairs(this Enum E)

Parameters

E Enum

The target enumerator.

Returns

KeyValuePair<string, int>[]

Returns a list of all tags along with their assigned values or an empty list.

Exceptions

ArgumentNullException

enumType is null.

GetName(Enum)

Retrieves the name of the constant in the specified enumeration that has the specified value.

public static string GetName(this Enum E)

Parameters

E Enum

The target enumerator.

Returns

string

A string containing the name of the enumerated constant in enumType whose value is value; or null if no such constant is found.

Exceptions

ArgumentNullException

enumType is null.

ArgumentException

enumType is not an Enum. -or- value is neither of type enumType nor does it have the same underlying type as enumType.

GetName(Enum, object)

Retrieves the name of the constant in the specified enumeration that has the specified value.

public static string GetName(this Enum E, object value)

Parameters

E Enum

The target enumerator.

value object

The value of a particular enumerated constant in terms of its underlying type.

Returns

string

A string containing the name of the enumerated constant in enumType whose value is value; or null if no such constant is found.

Exceptions

ArgumentNullException

enumType is null.

ArgumentException

enumType is not an Enum. -or- value is neither of type enumType nor does it have the same underlying type as enumType.

GetNames(Enum)

Retrieves an array of the names of the constants in a specified enumeration.

public static string[] GetNames(this Enum E)

Parameters

E Enum

The target enumerator.

Returns

string[]

A string array of the names of the constants in enumType.

Exceptions

ArgumentNullException

enumType is null.

ArgumentException

enumType parameter is not an Enum.

HasFlag(Enum, params Enum[])

Determines whether one or more bit fields are set in the current instance.

public static bool HasFlag(this Enum E, params Enum[] flags)

Parameters

E Enum

The target enumerator.

flags Enum[]

Comparison tags.

Returns

bool