Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Enum
Assembly: System.Runtime
Inheritance: object → ValueType → Enum
Provides the base class for enumerations.
Methods
public
int
CompareTo​(object target)
target
An object to compare, or <see langword="null" /> .
Returns A signed number that indicates the relative values of this instance and <paramref name="target" /> .
<list type="table">
<listheader>
<term> Value</term>
<description> Meaning</description>
</listheader>
<item>
<term> Less than zero</term>
<description> The value of this instance is less than the value of <paramref name="target" />.</description>
</item>
<item>
<term> Zero</term>
<description> The value of this instance is equal to the value of <paramref name="target" />.</description>
</item>
<item>
<term> Greater than zero</term>
<description> The value of this instance is greater than the value of <paramref name="target" />, or <paramref name="target" /> is <see langword="null" />.</description>
</item>
</list>
Compares this instance to a specified object and returns an indication of their relative values.
public
bool
Equals​(object obj)
obj
An object to compare with this instance, or <see langword="null" /> .
Returns <see langword="true" /> if <paramref name="obj" /> is an enumeration value of the same type and with the same underlying value as this instance; otherwise, <see langword="false" /> .
Returns a value indicating whether this instance is equal to a specified object.
public
int
GetHashCode​() Returns A 32-bit signed integer hash code.
Returns the hash code for the value of this instance.
public
TypeCode
GetTypeCode​() Returns The type code of the underlying type of this instance.
Returns the type code of the underlying type of this enumeration member.
public
bool
HasFlag​(Enum flag)
flag
An enumeration value.
Returns <see langword="true" /> if the bit field or bit fields that are set in <paramref name="flag" /> are also set in the current instance; otherwise, <see langword="false" /> .
Determines whether one or more bit fields are set in the current instance.
public
string
ToString​() Returns The string representation of the value of this instance.
Converts the value of this instance to its equivalent string representation.
public
string
ToString​(IFormatProvider provider)
provider
(obsolete)
Returns The string representation of the value of this instance.
This method overload is obsolete; use <see cref="M:System.Enum.ToString" /> .
public
string
ToString​(string format)
format
A format string.
Returns The string representation of the value of this instance as specified by <paramref name="format" /> .
Converts the value of this instance to its equivalent string representation using the specified format.
public
string
ToString​(string format,
IFormatProvider provider)
format
A format specification.
provider
(Obsolete.)
Returns The string representation of the value of this instance as specified by <paramref name="format" /> .
This method overload is obsolete; use <see cref="M:System.Enum.ToString(System.String)" /> .
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .