C# Enum枚举使用技巧
枚举使用技巧
/// <summary>
/// 日历简写字典
/// </summary>
public enum MonthType
{
JAN = 1,
FEB = 2,
MAR = 3,
APR = 4,
MAY = 5,
JUN = 6,
JUL = 7,
AUG = 8,
SEPT = 9,
OCT = 10,
NOV = 11,
DEC = 12
};
调用实例
//字符串转换int
string str = ((int)(MonthType)Enum.Parse(typeof(MonthType),"JAN")).ToString();
//网络素材仅限收藏 方便学习