C# Enum ToObject(Type, UInt64)
Description
Enum ToObject(Type, UInt64)
converts the specified
64-bit unsigned integer value to an enumeration member.
Syntax
Enum.ToObject(Type, UInt64)
has the following syntax.
[ComVisibleAttribute(true)]//w ww . j a v a2 s. c o m
[CLSCompliantAttribute(false)]
public static Object ToObject(
Type enumType,
ulong value
)
Parameters
Enum.ToObject(Type, UInt64)
has the following parameters.
enumType
- The enumeration type to return.value
- The value to convert to an enumeration member.
Returns
Enum.ToObject(Type, UInt64)
method returns An instance of the enumeration set to value.
Example
Converts the specified 64-bit unsigned integer value to an enumeration member.
//from ww w . j a v a 2 s .com
using System;
enum Mammals { Cat, Dog, Horse, Dolphin };
public class MainClass{
public static void Main(String[] argv){
Object obj = Enum.ToObject(Mammals.Cat.GetType(),0);
Console.WriteLine(obj);
}
}
The code above generates the following result.