public enum color {red=1,green=2,blue=3}
Type typ = typeof(color);
1、根据 索引获取 字符串 结果为 “red” 字符串
string s = typ.GetEnumName(1);
2、根据字符串获取索引 结果为 0
string s = Enum.Format(typ, Enum.Parse(typ, "Red"), "d");
3、将枚举字符串如 1、的"red" 转换为 枚举类型
int type=1
color=(color)Enum.Parse(typeof(color), typeof(color).GetEnumName(type));