Convert integer value to enum in CSharp
Description
The following code shows how to convert integer value to enum.
Example
//ww w .ja 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.