mscorlib(4.0.0.0) API with additions
|
Provides the base class for enumerations. More...
Public Member Functions | |
override bool | Equals (object obj) |
Returns a value indicating whether this instance is equal to a specified object. More... | |
unsafe override int | GetHashCode () |
Returns the hash code for the value of this instance. More... | |
override string | ToString () |
Converts the value of this instance to its equivalent string representation. More... | |
string | ToString (string format, IFormatProvider provider) |
This method overload is obsolete; use M:System.Enum.ToString(System.String). More... | |
int | CompareTo (object target) |
Compares this instance to a specified object and returns an indication of their relative values. More... | |
string | ToString (string format) |
Converts the value of this instance to its equivalent string representation using the specified format. More... | |
string | ToString (IFormatProvider provider) |
This method overload is obsolete; use M:System.Enum.ToString. More... | |
bool | HasFlag (Enum flag) |
Determines whether one or more bit fields are set in the current instance. More... | |
TypeCode | GetTypeCode () |
Returns the type code of the underlying type of this enumeration member. More... | |
Static Public Member Functions | |
static bool | TryParse< TEnum > (string value, out TEnum result) |
Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object. The return value indicates whether the conversion succeeded. More... | |
static bool | TryParse< TEnum > (string value, bool ignoreCase, out TEnum result) |
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-sensitive. The return value indicates whether the conversion succeeded. More... | |
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. More... | |
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. More... | |
static Type | GetUnderlyingType (Type enumType) |
Returns the underlying type of the specified enumeration. More... | |
static Array | GetValues (Type enumType) |
Retrieves an array of the values of the constants in a specified enumeration. More... | |
static string | GetName (Type enumType, object value) |
Retrieves the name of the constant in the specified enumeration that has the specified value. More... | |
static string [] | GetNames (Type enumType) |
Retrieves an array of the names of the constants in a specified enumeration. More... | |
static object | ToObject (Type enumType, object value) |
Converts the specified object with an integer value to an enumeration member. More... | |
static bool | IsDefined (Type enumType, object value) |
Returns an indication whether a constant with a specified value exists in a specified enumeration. More... | |
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. More... | |
static object | ToObject (Type enumType, sbyte value) |
Converts the specified 8-bit signed integer value to an enumeration member. More... | |
static object | ToObject (Type enumType, short value) |
Converts the specified 16-bit signed integer to an enumeration member. More... | |
static object | ToObject (Type enumType, int value) |
Converts the specified 32-bit signed integer to an enumeration member. More... | |
static object | ToObject (Type enumType, byte value) |
Converts the specified 8-bit unsigned integer to an enumeration member. More... | |
static object | ToObject (Type enumType, ushort value) |
Converts the specified 16-bit unsigned integer value to an enumeration member. More... | |
static object | ToObject (Type enumType, uint value) |
Converts the specified 32-bit unsigned integer value to an enumeration member. More... | |
static object | ToObject (Type enumType, long value) |
Converts the specified 64-bit signed integer to an enumeration member. More... | |
static object | ToObject (Type enumType, ulong value) |
Converts the specified 64-bit unsigned integer value to an enumeration member. More... | |
Protected Member Functions | |
Enum () | |
Initializes a new instance of the T:System.Enum class. More... | |
|
protected |
Initializes a new instance of the T:System.Enum class.
int System.Enum.CompareTo | ( | object | target | ) |
Compares this instance to a specified object and returns an indication of their relative values.
target | An object to compare, or null . |
null
. T:System.ArgumentException | target and this instance are not the same type. |
T:System.InvalidOperationException | This instance is not type T:System.SByte, T:System.Int16, T:System.Int32, T:System.Int64, T:System.Byte, T:System.UInt16, T:System.UInt32, or T:System.UInt64. |
override bool System.Enum.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 null . |
true
if obj is an enumeration value of the same type and with the same underlying value as this instance; otherwise, false
.
|
static |
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. |
T:System.ArgumentNullException | The enumType , value , or format parameter is null . |
T:System.ArgumentException | The enumType parameter is not an T:System.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 . |
T:System.FormatException | The format parameter contains an invalid value. |
T:System.InvalidOperationException | format equals "X", but the enumeration type is unknown. |
unsafe override int System.Enum.GetHashCode | ( | ) |
|
static |
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. |
null
if no such constant is found.T:System.ArgumentNullException | enumType or value is null . |
T:System.ArgumentException | enumType is not an T:System.Enum.-or- value is neither of type enumType nor does it have the same underlying type as enumType . |
|
static |
Retrieves an array of the names of the constants in a specified enumeration.
enumType | An enumeration type. |
T:System.ArgumentNullException | enumType is null . |
T:System.ArgumentException | enumType parameter is not an T:System.Enum. |
TypeCode System.Enum.GetTypeCode | ( | ) |
Returns the type code of the underlying type of this enumeration member.
T:System.InvalidOperationException | The enumeration type is unknown. |
Implements System.IConvertible.
Returns the underlying type of the specified enumeration.
enumType | The enumeration whose underlying type will be retrieved. |
T:System.ArgumentNullException | enumType is null . |
T:System.ArgumentException | enumType is not an T:System.Enum. |
Retrieves an array of the values of the constants in a specified enumeration.
enumType | An enumeration type. |
T:System.ArgumentNullException | enumType is null . |
T:System.ArgumentException | enumType is not an T:System.Enum. |
T:System.InvalidOperationException | The method is invoked by reflection in a reflection-only context, -or- <paramref name="enumType" /> is a type from an assembly loaded in a reflection-only context.</exception> |
bool System.Enum.HasFlag | ( | Enum | flag | ) |
Determines whether one or more bit fields are set in the current instance.
flag | An enumeration value. |
true
if the bit field or bit fields that are set in flag are also set in the current instance; otherwise, false
.T:System.ArgumentException | flag is a different type than the current instance. |
|
static |
Returns an indication whether a constant with a specified value exists in a specified enumeration.
enumType | An enumeration type. |
value | The value or name of a constant in enumType . |
true
if a constant in enumType has a value equal to value ; otherwise, false
.T:System.ArgumentNullException | enumType or value is null . |
T:System.ArgumentException | enumType is not an Enum .-or- The type of value is an enumeration, but it is not an enumeration of type enumType .-or- The type of value is not an underlying type of enumType . |
T:System.InvalidOperationException | value is not type T:System.SByte, T:System.Int16, T:System.Int32, T:System.Int64, T:System.Byte, T:System.UInt16, T:System.UInt32, or T:System.UInt64, or T:System.String. |
|
static |
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. |
T:System.ArgumentNullException | enumType or value is null . |
T:System.ArgumentException | enumType is not an T:System.Enum.-or- value is either an empty string or only contains white space.-or- value is a name, but not one of the named constants defined for the enumeration. |
T:System.OverflowException | value is outside the range of the underlying type of enumType . |
|
static |
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 | true to ignore case; false to regard case. |
T:System.ArgumentNullException | enumType or value is null . |
T:System.ArgumentException | enumType is not an T:System.Enum.-or- value is either an empty string ("") or only contains white space.-or- value is a name, but not one of the named constants defined for the enumeration. |
T:System.OverflowException | value is outside the range of the underlying type of enumType . |
|
static |
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. |
T:System.ArgumentNullException | enumType or value is null . |
T:System.ArgumentException | enumType is not an T:System.Enum.-or- value is not type T:System.SByte, T:System.Int16, T:System.Int32, T:System.Int64, T:System.Byte, T:System.UInt16, T:System.UInt32, or T:System.UInt64. |
|
static |
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. |
T:System.ArgumentNullException | enumType is null . |
T:System.ArgumentException | enumType is not an T:System.Enum. |
|
static |
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. |
T:System.ArgumentNullException | enumType is null . |
T:System.ArgumentException | enumType is not an T:System.Enum. |
|
static |
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. |
T:System.ArgumentNullException | enumType is null . |
T:System.ArgumentException | enumType is not an T:System.Enum. |
|
static |
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. |
T:System.ArgumentNullException | enumType is null . |
T:System.ArgumentException | enumType is not an T:System.Enum. |
|
static |
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. |
T:System.ArgumentNullException | enumType is null . |
T:System.ArgumentException | enumType is not an T:System.Enum. |
|
static |
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. |
T:System.ArgumentNullException | enumType is null . |
T:System.ArgumentException | enumType is not an T:System.Enum. |
|
static |
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. |
T:System.ArgumentNullException | enumType is null . |
T:System.ArgumentException | enumType is not an T:System.Enum. |
|
static |
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. |
T:System.ArgumentNullException | enumType is null . |
T:System.ArgumentException | enumType is not an T:System.Enum. |
override string System.Enum.ToString | ( | ) |
string System.Enum.ToString | ( | string | format, |
IFormatProvider | provider | ||
) |
This method overload is obsolete; use M:System.Enum.ToString(System.String).
format | A format specification. |
provider | (Obsolete.) |
T:System.FormatException | format does not contain a valid format specification. |
T:System.InvalidOperationException | format equals "X", but the enumeration type is unknown. |
Implements System.IFormattable.
string System.Enum.ToString | ( | string | format | ) |
Converts the value of this instance to its equivalent string representation using the specified format.
format | A format string. |
T:System.FormatException | format contains an invalid specification. |
T:System.InvalidOperationException | format equals "X", but the enumeration type is unknown. |
string System.Enum.ToString | ( | IFormatProvider | provider | ) |
This method overload is obsolete; use M:System.Enum.ToString.
provider | (obsolete) |
Implements System.IConvertible.
|
static |
Converts the string representation of the name or numeric value of one or more enumerated constants to an equivalent enumerated object. The return value indicates whether the conversion succeeded.
value | The string representation of the enumeration name or underlying value to convert. |
result | When this method returns, result contains an object of type TEnum whose value is represented by value if the parse operation succeeds. If the parse operation fails, result contains the default value of the underlying type of TEnum . Note that this value need not be a member of the TEnum enumeration. This parameter is passed uninitialized. |
TEnum | The enumeration type to which to convert value . |
true
if the value parameter was converted successfully; otherwise, false
.T:System.ArgumentException | TEnum is not an enumeration type. |
TEnum | : | struct |
|
static |
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-sensitive. The return value indicates whether the conversion succeeded.
value | The string representation of the enumeration name or underlying value to convert. |
ignoreCase | true to ignore case; false to consider case. |
result | When this method returns, result contains an object of type TEnum whose value is represented by value if the parse operation succeeds. If the parse operation fails, result contains the default value of the underlying type of TEnum . Note that this value need not be a member of the TEnum enumeration. This parameter is passed uninitialized. |
TEnum | The enumeration type to which to convert value . |
true
if the value parameter was converted successfully; otherwise, false
.T:System.ArgumentException | TEnum is not an enumeration type. |
TEnum | : | struct |