BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 System.ValueType System.IComparable System.IConvertible System.IFormattable

Provides support for all enumeration types. Serves as the base class for all enumeration types.

A is a distinct type with named constant members. Each enumeration type has a corresponding integral type called the of the enumeration type.

This underlying type is required to be a system-supplied integer type that is large enough to represent all values defined in the enumeration; the field that holds the underlying type must be called . A declaration is allowed to explicitly declare any integral type other than as an underlying type. This includes , , , , , , , and . A declaration that does not explicitly declare an underlying type has an underlying type of

.

derives from but is not a value type. Programming languages typically provide syntax to declare sets of a specified enumeration type consisting of named constants and their values.

It is possible to treat instances of a as bit fields containing multiple values. For more information, see .

provides methods to compare instances of enumeration types, convert the value of an instance to its representation, convert the representation of a number to an instance of the enumeration type, and create an instance of a specified enumeration and value.

- Constructor
  To be added.
  To be added.
  1.0.5000.0
  2.0.0.0
- Method
  System.Int32 `` An object to compare the current instance to.

  Returns the sort order of the current instance compared to the specified .

  The return value is a negative number, zero, or a positive number reflecting the sort order of the current instance as compared to . For non-zero return values, the exact value returned by this method is unspecified. The following table defines the return value:

  Return Value
  Description
  A negative integer
  The value of the current instance is less than the value of .
  Zero
  The value of the current instance is equal to the value of .
  Any positive integer
  The value of the current instance is greater than the value of , or is .

  This method is implemented to support the interface.

  and the current instance are not of the same enumeration type. 0 1.0.5000.0 2.0.0.0
- Method
  System.Boolean `` An object to compare the current instance to. To be added.

  Determines whether the current instance and the specified represent the same type and value.

  if is of the same enumeration type and represents the same value as the current instance; otherwise, .

  This method overrides .

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.String `` `` `` A that specifies the type of the enumeration of which is a member. The enumeration element to be converted. A that specifies the output format to use. To be added. To be added.

  Converts the specified element of the specified enumeration type to its representation using the specified format.

  The representation of the value of the enumeration element.

  For cross-platform portability, the only valid values for are:

  Format
  Description
  "G" or "g"

  If value is equal to a defined value of , returns the element name defined for value. If the attribute is set on the declaration and is a built-in integer type and is equal to a summation of enumeration elements, the return value contains the element names in an unspecified order, separated by commas (e.g. "Red, Yellow"). Otherwise, is returned in

  decimal format.

  "X" or "x"
  Returns in hexadecimal format, without a leading 0x. The value is padded with leading zeroes to ensure the returned value is at least eight digits in length.
  "F" or "f"
  Behaves identically to "G", except the is not required to be present on the declaration.
  "D" or "d"
  Returns in decimal format with no leading zeroes. , or is a null reference.

  is not a .

  -or-

  is neither of type nor does it have the same underlying type as .

  contains an invalid value.

  The following example demonstrates formatting enumeration values.

  `using System; public enum Signs { Stop = 1, Yield = 2, Merge = 4 }; [Flags] public enum Lights { Red = 1, Yellow = 2, Green = 4 }; public class EnumCompTo { public static void Main() { Console.WriteLine(Signs.Format(typeof(Signs), Signs.Merge, "d")); Console.WriteLine(Signs.Format(typeof(Signs), 7, "g")); Console.WriteLine(Lights.Format(typeof(Lights), Lights.Yellow, "x")); Console.WriteLine(Lights.Format(typeof(Lights), 7, "g")); } }`

  The output is

  4

  7

  00000002

  Red, Yellow, Green

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Int32

  Generates a hash code for the current instance.

  A containing a hash code for the current instance.

  The algorithm used to generate the hash code is unspecified.

  This method overrides .

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.String `` `` A that specifies the type of the enumeration. A that contains the integral value or the name of an enumeration constant.

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

  A containing the name of the enumerated constant in whose value is , or a null reference if no such constant is found. If multiple constants have the same value, as to which name is returned for that value, is unspecified.

  To be added. or is a null reference.

  is not a that describes a .

  -or-

  is neither of type nor does it have the same underlying type as .

  The following example demonstrates the method.

  `using System; public enum Signs { Stop = 1, Yield = 2, Merge = 4 }; public class EnumCompTo { public static void Main() { Console.Write( "The name of the constant with the value 4 is: " ); Console.WriteLine( "{0}.", Signs.GetName(typeof(Signs), 4)); Console.Write( "The name of the constant with the value Stop is: " ); Console.WriteLine( "{0}.", Signs.GetName(typeof(Signs), Signs.Stop )); } }`

  The output is

  The name of the constant with the value 4 is: Merge.

  The name of the constant with the value Stop is: Stop.

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.String[] `` A that specifies the type of an enumeration.

  Returns a zero-based, one-dimensional array that contains the names of the constants of the specified enumeration type.

  A vector of the names of the constants in . The elements of the vector are sorted by the values of the enumerated constants. If multiple constants have the same value, the order in which their names appear in the vector, relative to each other, is unspecified.

  To be added. is a null reference.

  is not a that describes a .

  The following example demonstrates the method.

  `using System; public enum Colors { Red, White, Blue }; public class enumGetNames { public static void Main() { int i = 0; String[] strAry = Colors.GetNames( typeof(Colors) ); foreach (String str in strAry) { Console.Write("The value indexed '{0}' ", i++ ); Console.WriteLine("is {0}.", str); } } }`

  The output is

  The value indexed '0' is Red.

  The value indexed '1' is White.

  The value indexed '2' is Blue.

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.TypeCode To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Type `` The of an enumeration.

  Returns the underlying type of the specified enumeration type.

  A instance that describes the underlying type of .

  To be added. is a null reference.

  is not an enumeration type.

  The following example demonstrates the method.

  `using System; public enum Colors { Red, White, Blue } public class EnumUnderlyingTypeTest { public static void Main() { Type t = Colors.GetUnderlyingType( typeof(Colors) ); Console.WriteLine("The underlying type of Colors is {0}.", t.ToString()); } }`

  The output is

  The underlying type of Colors is System.Int32.

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Array `` The of an enumeration.

  Returns a zero-based, one-dimensional array of the values of the constants of the specified enumeration type.

  A vector of the enumeration type specified by containing the values of the constants in . The elements of the array are sorted by the values of the enumeration constants. If multiple constants have the same value, the value of each is included in the array.

  To be added. is a null reference.

  is not an enumeration type.

  The following example demonstrates the method.

  `using System; public enum Colors { Red = 1, White = 2, Blue = 4 } public class enumGetValues { public static void Main() { Array valueAry = Enum.GetValues(typeof(Colors)); foreach (int i in valueAry) { Console.WriteLine("The value of element {0} is {1}", Enum.Format(typeof(Colors), i, "g"),i); } } }`

  The output is

  The value of element Red is 1.

  The value of element White is 2.

  The value of element Blue is 4.

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Boolean `` `` A that describes an enumeration. The constant or value being searched for in . To be added.

  Returns a indicating whether a constant with the specified value exists in the specified enumeration type.

  if a constant in the enumeration described by has a value equal to ; otherwise, .

  To be added. or is a null reference.

  is not an enumeration type.

  -or-

  The type of is not an or an underlying type of .

  The following example demonstrates the method.

  `using System; public enum Colors { Red = 1, White = 2, Blue = 4 } public class enumIsDefined { public static void Main() { Console.Write("It is {0} ", Enum.IsDefined(typeof(Colors), 1)); Console.WriteLine("that '1' is defined in 'Colors'."); Console.Write("It is {0} ", Enum.IsDefined(typeof(Colors), 3)); Console.WriteLine("that '3' is defined in 'Colors'."); } }`

  The output is

  It is True that '1' is defined in 'Colors'.

  It is False that '3' is defined in 'Colors'.

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Object `` `` The of an enumeration. A containing one or more names or a single numeric value to convert. If the string contains more than one name, each name is required to be separated by a comma (','). The names are parsed in a case-sensitive manner. The names or number can be surrounded by any amount of white space. To be added.

  Converts the specified representation of one or more enumerated constants of a specified enumeration type to an equivalent enumerated object.

  A of type whose values are represented by .

  This version of is equivalent to (, , ).

  or is a null reference.

  is not a that describes a .

  -or-

  is either equal to or contains only white space.

  -or-

  represents one or more names, and at least one name represented by is not of type .

  The following example demonstrates the method.

  `using System; public enum Colors { Red = 1, Blue = 2 } public class enumTest { public static void Main() { object o = Enum.Parse( typeof (Colors), "Red, Blue"); Type oType = o.GetType(); Console.WriteLine("The type of the object returned is {0}",oType.ToString()); Array values = Enum.GetValues(oType); foreach (Colors c in values) { Console.WriteLine(Enum.Format(oType,c,"D")); } } }`

  The output is

  The type of the object returned is Colors

  1

  2

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Object `` `` `` The of an enumeration.

  A containing one or more names or a single numeric value to convert. If the string contains more than one name, each name is required to be separated by a comma (','). The names or number can be surrounded by any amount of white space.

  A value. Specify to have names in parsed in a case-insensitive manner. Specify to have names parsed in a case-sensitive manner. To be added.

  Converts the specified representation of one or more enumerated constants of a specified enumeration type to an equivalent enumerated object. This method behaves in a case-sensitive or insensitive manner according to the specified .

  A of type whose values are represented by .

  To be added. or is a null reference.

  is not a that describes a .

  -or-

  is either equal to or contains only white space.

  -or-

  represents one or more names, and at least one name represented by is not of type .

  For an example that demonstrates parsing strings containing enumeration values, see (, ).

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Boolean `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Byte `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Char `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.DateTime `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Decimal `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Double `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Int16 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Int32 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Int64 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.SByte `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Single `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Object `` `` To be added. To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.UInt16 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.UInt32 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.UInt64 `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Method
  System.Object `` `` The of an enumeration. The value to set. To be added.

  Returns an instance of the specified enumeration type set to the specified value.

  An enumeration object of type whose value is .

  To be added. is a null reference.

  is not a that describes a .

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Object `` `` The of an enumeration. The value to set. To be added.

  Returns an instance of the specified enumeration type set to the specified value.

  An enumeration object of type whose value is .

  To be added. is a null reference.

  is not a that describes a .

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Object `` `` The of an enumeration. The value to set. To be added.

  Returns an instance of the specified enumeration type set to the specified value.

  An enumeration object of type whose value is .

  To be added. is a null reference.

  is not a that describes a .

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Object `` `` The of an enumeration. The value to set. To be added.

  Returns an instance of the specified enumeration type set to the specified value.

  An enumeration object of type whose value is .

  To be added. is a null reference.

  is not a that describes a .

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Object `` `` The of the enumeration. The value to set. To be added.

  Returns an instance of the specified enumeration type set to the specified value.

  An enumeration object of type whose value is .

  To be added. is a null reference.

  is not a that describes a .

  0
  1.0.5000.0
  2.0.0.0
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Object `` `` The of an enumeration. The value to set. To be added.

  Returns an instance of the specified enumeration type set to the specified value.

  An enumeration object of type whose value is .

  This member is not CLS-compliant. For a CLS-compliant alternative, use (, ).

  is a null reference.

  is not a that describes a .

  0
  1.0.5000.0
  2.0.0.0
  System.CLSCompliant(false)
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Object `` `` The of an enumeration. The value to set. To be added.

  Returns an instance of the specified enumeration type set to the specified value.

  An enumeration object of type whose value is .

  This member is not CLS-compliant. For a CLS-compliant alternative, use (, ).

  is a null reference.

  is not a that describes a .

  0
  1.0.5000.0
  2.0.0.0
  System.CLSCompliant(false)
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Object `` `` The of an enumeration. The value to set. To be added.

  Returns an instance of the specified enumeration type set to the specified value.

  An enumeration object of type whose value is .

  This member is not CLS-compliant. For a CLS-compliant alternative, use (, ).

  is a null reference.

  is not a that describes a .

  0
  1.0.5000.0
  2.0.0.0
  System.CLSCompliant(false)
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.Object `` `` The of an enumeration. The value to set. To be added.

  Returns an instance of the specified enumeration type set to the specified value.

  An enumeration object of type whose value is .

  This member is not CLS-compliant. For a CLS-compliant alternative, use (, ).

  is a null reference.

  is not a that describes a .

  0
  1.0.5000.0
  2.0.0.0
  System.CLSCompliant(false)
  System.Runtime.InteropServices.ComVisible(true)
- Method
  System.String

  Converts the name of the value of the current instance to its equivalent representation.

  The representation of the named constant specified by the current instance.

  This version of is equivalent to ("G", ).

  This method returns the same value as with the "g" or "G" format option.

  An instance of an enumeration is set to a named constant value. This method returns the name of the constant an instance is set to, not the value itself.

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.String `` An object that implements the interface or a null reference. The is not used in the implementation of this method. There is no that corresponds to a object; therefore, is not utilized by this method, and any may be passed as a parameter.

  Converts the name of the value of the current instance to its equivalent representation.

  The representation of the name of the value of the current instance.

  This method is equivalent to the version of that takes no arguments.

  0
  1.0.5000.0
  2.0.0.0
  System.Obsolete("Provider is ignored, just use ToString")
- Method
  System.String `` A that specifies the format to use when converting the current instance to a . Specify one of the following values in upper or lowercase: "G", "D", "X", or "F" .

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

  The representation of the value of the current instance as specified by .

  If is a null reference or an empty string, the return value is formatted using the general format specifier ("G").

  For details on the format specifiers used with an enumeration object, see .

  contains an invalid value. 0 1.0.5000.0 2.0.0.0
- Method
  System.String `` `` A that specifies the format to use when converting the current instance to a . Specify one of the following values in upper or lower case: "G", "D", "X", or "F" . An object that implements the interface or a null reference. The is not used in the implementation of this method. There is no that corresponds to a object; therefore, is not utilized by this method, and any may be passed as a parameter. To be added. To be added.

  Converts the numeric value of the current instance to its equivalent representation using the specified format.

  The representation of the value of the current instance as specified by .

  If is a null reference or an empty string, the return value is formatted using the general format specifier ("G").

  For details on the format specifiers used with an enumeration object, see .

  This method is implemented to support the interface.

  does not contain a valid format specifier. 0 1.0.5000.0 2.0.0.0 System.Obsolete("Provider is ignored, just use ToString")
0 System.Runtime.InteropServices.ComVisible(true)