|
|
System.Enum Class |
|
|
Description | |
|
Enumerations in .Net are similar to enumerations in native Delphi. They provide a means of naming constant values, with a particular enumeration value only allowed to have one of the named values.
For example, the DayOfWeek enumeration has the following contents :
Sunday | = 0 |
Monday | = 1 |
Tuesday | = 2 |
Wednesday | = 3 |
Thursday | = 4 |
Friday | = 5 |
Saturday | = 6 |
Unlike native Delphi, .Net Enumerations can be optionally treated as Flags. They therefore become equivalent to Sets in native Delphi. An enum is a set of flags when the [FlagsAttribute] is specified immediately prior to the Enum definition :
type
[FlagsAttribute]
Flags = (Sexy, Clever, Handsome);
|
|
Methods | |
|
| CompareTo | Compare the current enum value to another enum |
| Equals | Determines if the current enum value equals another |
| Format | Formats the current Enum value into a string |
| GetName | Gets the name of a specified enumeration value |
| GetNames | Gets a list of the names of a specified enumeration type |
| GetValues | Gets a list of the names of a specified enumeration type |
| IsDefined | Determines whether an object has a valid enumerated value |
| Parse | Builds an enum object from an enum type and a string of enum values |
| ToObject | Creates an Enum object of the specified type and value |
| ToString | Converts the current Enum value to a string |
|
|
|
Microsoft MSDN links | |
|
|
|
|
|
|