class Enum

in global :: System

Provides the base class for enumerations.


public int CompareTo( object target )

Compares this instance to a specified object and returns an indication of their relative values.

  • target An object to compare, or .
  • Returns A signed number that indicates the relative values of this instance and . Value Meaning Less than zero The value of this instance is less than the value of . Zero The value of this instance is equal to the value of . Greater than zero The value of this instance is greater than the value of . -or- is .

public bool Equals( object obj )

Returns a value indicating whether this instance is equal to a specified object.

  • obj An object to compare with this instance, or .
  • Returns if is an enumeration value of the same type and with the same underlying value as this instance; otherwise, .

public static string Format( Type enumType, object value, string format )

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

  • enumType The enumeration type of the value to convert.
  • value The value to convert.
  • format The output format to use.
  • Returns A string representation of .

public static string GetName( Type enumType, object value )

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

  • enumType An enumeration type.
  • value The value of a particular enumerated constant in terms of its underlying type.
  • Returns A string containing the name of the enumerated constant in whose value is ; or if no such constant is found.

public static string[] GetNames( Type enumType )

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

  • enumType An enumeration type.
  • Returns A string array of the names of the constants in .

public static Type GetUnderlyingType( Type enumType )

Returns the underlying type of the specified enumeration.

  • enumType The enumeration whose underlying type will be retrieved.
  • Returns The underlying type of .

public static Array GetValues( Type enumType )

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

  • enumType An enumeration type.
  • Returns An array that contains the values of the constants in .

public bool HasFlag( Enum flag )

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

  • flag An enumeration value.
  • Returns if the bit field or bit fields that are set in are also set in the current instance; otherwise, .

public static bool IsDefined( Type enumType, object value )

Returns a Boolean telling whether a given integral value, or its name as a string, exists in a specified enumeration.

  • enumType An enumeration type.
  • value The value or name of a constant in .
  • Returns if a constant in has a value equal to ; otherwise, .

public static object Parse( Type enumType, string value )

Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object.

  • enumType An enumeration type.
  • value A string containing the name or value to convert.
  • Returns An object of type whose value is represented by .

public static object Parse( Type enumType, string value, bool ignoreCase )

Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object. A parameter specifies whether the operation is case-insensitive.

  • enumType An enumeration type.
  • value A string containing the name or value to convert.
  • ignoreCase to ignore case; to regard case.
  • Returns An object of type whose value is represented by .

public static object ToObject( Type enumType, byte value )

Converts the specified 8-bit unsigned integer to an enumeration member.

  • enumType The enumeration type to return.
  • value The value to convert to an enumeration member.
  • Returns An instance of the enumeration set to .

public static object ToObject( Type enumType, short value )

Converts the specified 16-bit signed integer to an enumeration member.

  • enumType The enumeration type to return.
  • value The value to convert to an enumeration member.
  • Returns An instance of the enumeration set to .

public static object ToObject( Type enumType, int value )

Converts the specified 32-bit signed integer to an enumeration member.

  • enumType The enumeration type to return.
  • value The value to convert to an enumeration member.
  • Returns An instance of the enumeration set to .

public static object ToObject( Type enumType, long value )

Converts the specified 64-bit signed integer to an enumeration member.

  • enumType The enumeration type to return.
  • value The value to convert to an enumeration member.
  • Returns An instance of the enumeration set to .

public static object ToObject( Type enumType, object value )

Converts the specified object with an integer value to an enumeration member.

  • enumType The enumeration type to return.
  • value The value convert to an enumeration member.
  • Returns An enumeration object whose value is .

public static object ToObject( Type enumType, sbyte value )

Converts the specified 8-bit signed integer value to an enumeration member.

  • enumType The enumeration type to return.
  • value The value to convert to an enumeration member.
  • Returns An instance of the enumeration set to .

public static object ToObject( Type enumType, ushort value )

Converts the specified 16-bit unsigned integer value to an enumeration member.

  • enumType The enumeration type to return.
  • value The value to convert to an enumeration member.
  • Returns An instance of the enumeration set to .

public static object ToObject( Type enumType, uint value )

Converts the specified 32-bit unsigned integer value to an enumeration member.

  • enumType The enumeration type to return.
  • value The value to convert to an enumeration member.
  • Returns An instance of the enumeration set to .

public static object ToObject( Type enumType, ulong value )

Converts the specified 64-bit unsigned integer value to an enumeration member.

  • enumType The enumeration type to return.
  • value The value to convert to an enumeration member.
  • Returns An instance of the enumeration set to .

public string ToString( IFormatProvider provider )

This method overload is obsolete; use .

  • provider (obsolete)
  • Returns The string representation of the value of this instance.

public string ToString( string format )

Converts the value of this instance to its equivalent string representation using the specified format.

  • format A format string.
  • Returns The string representation of the value of this instance as specified by .

public string ToString( string format, IFormatProvider provider )

This method overload is obsolete; use .

  • format A format specification.
  • provider (Obsolete.)
  • Returns The string representation of the value of this instance as specified by .

public static bool TryParse( Type enumType, string value, bool ignoreCase, ref object result )

No summary.

public static bool TryParse( Type enumType, string value, ref object result )

No summary.

public TypeCode GetTypeCode( )

😔 No documentation found.

public static bool TryFormat( TEnum value, Span<char> destination, ref int charsWritten, ReadOnlySpan<char> format = null )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public static bool TryParse( Type enumType, ReadOnlySpan<char> value, bool ignoreCase, ref object result )

😔 No documentation found.

public static string GetName( TEnum value )

😔 No documentation found.

public static string[] GetNames( )

😔 No documentation found.

public static TEnum[] GetValues( )

😔 No documentation found.

public static Array GetValuesAsUnderlyingType( )

😔 No documentation found.

public static Array GetValuesAsUnderlyingType( Type enumType )

😔 No documentation found.

public static bool IsDefined( TEnum value )

😔 No documentation found.

public static object Parse( Type enumType, ReadOnlySpan<char> value )

😔 No documentation found.

public static object Parse( Type enumType, ReadOnlySpan<char> value, bool ignoreCase )

😔 No documentation found.

public static TEnum Parse( string value )

😔 No documentation found.

public static TEnum Parse( ReadOnlySpan<char> value )

😔 No documentation found.

public static TEnum Parse( string value, bool ignoreCase )

😔 No documentation found.

public static TEnum Parse( ReadOnlySpan<char> value, bool ignoreCase )

😔 No documentation found.

public static bool TryParse( Type enumType, ReadOnlySpan<char> value, ref object result )

😔 No documentation found.

public static bool TryParse( string value, ref TEnum result )

😔 No documentation found.

public static bool TryParse( ReadOnlySpan<char> value, ref TEnum result )

😔 No documentation found.

public static bool TryParse( string value, bool ignoreCase, ref TEnum result )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public static bool TryParse( ReadOnlySpan<char> value, bool ignoreCase, ref TEnum result )

😔 No documentation found.