ערוך

שתף באמצעות


Enum Class

Definition

Provides the base class for enumerations.

public ref class Enum abstract : ValueType, IComparable, IConvertible, IFormattable
public ref class Enum abstract : ValueType, IComparable, IConvertible, ISpanFormattable
public ref class Enum abstract : ValueType, IComparable, IFormattable
public abstract class Enum : ValueType, IComparable, IConvertible, IFormattable
public abstract class Enum : ValueType, IComparable, IConvertible, ISpanFormattable
[System.Serializable]
public abstract class Enum : ValueType, IComparable, IConvertible, IFormattable
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class Enum : ValueType, IComparable, IConvertible, IFormattable
public abstract class Enum : ValueType, IComparable, IFormattable
type Enum = class
    inherit ValueType
    interface IComparable
    interface IConvertible
    interface IFormattable
type Enum = class
    inherit ValueType
    interface IComparable
    interface IConvertible
    interface ISpanFormattable
    interface IFormattable
type Enum = class
    inherit ValueType
    interface IComparable
    interface IConvertible
    interface IFormattable
    interface ISpanFormattable
[<System.Serializable>]
type Enum = class
    inherit ValueType
    interface IComparable
    interface IFormattable
    interface IConvertible
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type Enum = class
    inherit ValueType
    interface IComparable
    interface IFormattable
    interface IConvertible
type Enum = class
    inherit ValueType
    interface IComparable
    interface IFormattable
Public MustInherit Class Enum
Inherits ValueType
Implements IComparable, IConvertible, IFormattable
Public MustInherit Class Enum
Inherits ValueType
Implements IComparable, IConvertible, ISpanFormattable
Public MustInherit Class Enum
Inherits ValueType
Implements IComparable, IFormattable
Inheritance
Derived
Attributes
Implements

Remarks

For more information about this API, see Supplemental API remarks for Enum.

Constructors

Enum()

Initializes a new instance of the Enum class.

Methods

CompareTo(Object)

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

Equals(Object)

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

Format(Type, Object, String)

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

GetHashCode()

Returns the hash code for the value of this instance.

GetName(Type, Object)

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

GetName<TEnum>(TEnum)

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

GetNames(Type)

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

GetNames<TEnum>()

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

GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetTypeCode()

Returns the type code of the underlying type of this enumeration member.

GetUnderlyingType(Type)

Returns the underlying type of the specified enumeration.

GetValues(Type)

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

GetValues<TEnum>()

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

GetValuesAsUnderlyingType(Type)

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

GetValuesAsUnderlyingType<TEnum>()

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

HasFlag(Enum)

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

IsDefined(Type, Object)

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

IsDefined<TEnum>(TEnum)

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

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Parse(Type, ReadOnlySpan<Char>)

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

Parse(Type, ReadOnlySpan<Char>, Boolean)

Converts the span of characters 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.

Parse(Type, String)

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

Parse(Type, String, Boolean)

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.

Parse<TEnum>(ReadOnlySpan<Char>)

Converts the span of characters representation of the name or numeric value of one or more enumerated constants specified by TEnum to an equivalent enumerated object.

Parse<TEnum>(ReadOnlySpan<Char>, Boolean)

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

Parse<TEnum>(String)

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

Parse<TEnum>(String, Boolean)

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

ToObject(Type, Byte)

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

ToObject(Type, Int16)

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

ToObject(Type, Int32)

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

ToObject(Type, Int64)

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

ToObject(Type, Object)

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

ToObject(Type, SByte)

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

ToObject(Type, UInt16)

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

ToObject(Type, UInt32)

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

ToObject(Type, UInt64)

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

ToString()

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

ToString(IFormatProvider)
Obsolete.
Obsolete.

This method overload is obsolete; use ToString().

ToString(String)

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

ToString(String, IFormatProvider)
Obsolete.
Obsolete.

This method overload is obsolete; use ToString(String).

TryFormat<TEnum>(TEnum, Span<Char>, Int32, ReadOnlySpan<Char>)

Tries to format the value of the enumerated type instance into the provided span of characters.

TryParse(Type, ReadOnlySpan<Char>, Boolean, Object)

Converts the span of characters 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.

TryParse(Type, ReadOnlySpan<Char>, Object)

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

TryParse(Type, String, Boolean, Object)

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

TryParse(Type, String, Object)

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

TryParse<TEnum>(ReadOnlySpan<Char>, Boolean, TEnum)

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.

TryParse<TEnum>(ReadOnlySpan<Char>, TEnum)

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

TryParse<TEnum>(String, Boolean, TEnum)

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.

TryParse<TEnum>(String, TEnum)

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.

Explicit Interface Implementations

IConvertible.GetTypeCode()

Returns the type code of this Enum instance.

IConvertible.ToBoolean(IFormatProvider)

Converts the current value to a Boolean value based on the underlying type.

IConvertible.ToByte(IFormatProvider)

Converts the current value to an 8-bit unsigned integer based on the underlying type.

IConvertible.ToChar(IFormatProvider)

Converts the current value to a Unicode character based on the underlying type.

IConvertible.ToDateTime(IFormatProvider)

Converts the current value to a DateTime based on the underlying type.

IConvertible.ToDecimal(IFormatProvider)

Converts the current value to a Decimal based on the underlying type.

IConvertible.ToDouble(IFormatProvider)

Converts the current value to a double-precision floating point number based on the underlying type.

IConvertible.ToInt16(IFormatProvider)

Converts the current value to a 16-bit signed integer based on the underlying type.

IConvertible.ToInt32(IFormatProvider)

Converts the current value to a 32-bit signed integer based on the underlying type.

IConvertible.ToInt64(IFormatProvider)

Converts the current value to a 64-bit signed integer based on the underlying type.

IConvertible.ToSByte(IFormatProvider)

Converts the current value to an 8-bit signed integer based on the underlying type.

IConvertible.ToSingle(IFormatProvider)

Converts the current value to a single-precision floating-point number based on the underlying type.

IConvertible.ToString(IFormatProvider)
Obsolete.

This method overload is obsolete; use ToString() instead.

IConvertible.ToType(Type, IFormatProvider)

Converts the current value to a specified type based on the underlying type.

IConvertible.ToUInt16(IFormatProvider)

Converts the current value to a 16-bit unsigned integer based on the underlying type.

IConvertible.ToUInt32(IFormatProvider)

Converts the current value to a 32-bit unsigned integer based on the underlying type.

IConvertible.ToUInt64(IFormatProvider)

Converts the current value to a 64-bit unsigned integer based on the underlying type.

IFormattable.ToString(String, IFormatProvider)
Obsolete.

This method overload is obsolete; use ToString(String).

ISpanFormattable.TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Tries to format the value of the enum into the provided span of characters.

Applies to

Thread Safety

This type is thread safe.

See also