public class StatusClass
{
public enum ssnState : int
{
//未完成
未完成 = 0,
//已完成
已完成 = 1,
//重新打开
重新打开 = -1,
//取消
取消 = -5,
//暂停
暂停 = -10
}
public static string GetStatName(int statid)
{
string name = "";
foreach (int i in Enum.GetValues(typeof (ssnState)))
{
string s = Enum.GetName(typeof (ssnState), i);
if (statid == i)
{
name = s;
}
}
return name;
}
}
{
public enum ssnState : int
{
//未完成
未完成 = 0,
//已完成
已完成 = 1,
//重新打开
重新打开 = -1,
//取消
取消 = -5,
//暂停
暂停 = -10
}
public static string GetStatName(int statid)
{
string name = "";
foreach (int i in Enum.GetValues(typeof (ssnState)))
{
string s = Enum.GetName(typeof (ssnState), i);
if (statid == i)
{
name = s;
}
}
return name;
}
}
本文详细介绍了状态类的定义及其内部枚举状态的使用,包括如何通过状态ID获取对应的状态名称,提供了完整的代码实现及注释。
981

被折叠的 条评论
为什么被折叠?



