C# Enum ToObject(Type, UInt32)
Description
Enum ToObject(Type, UInt32)
converts the specified
32-bit unsigned integer value to an enumeration member.
Syntax
Enum.ToObject(Type, UInt32)
has the following syntax.
[CLSCompliantAttribute(false)]/* w ww . j a va 2 s . c o m*/
[ComVisibleAttribute(true)]
public static Object ToObject(
Type enumType,
uint value
)
Parameters
Enum.ToObject(Type, UInt32)
has the following parameters.
enumType
- The enumeration type to return.value
- The value to convert to an enumeration member.
Returns
Enum.ToObject(Type, UInt32)
method returns An instance of the enumeration set to value.
Example
//ww w .j a va 2s.c o m
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.