写一个方法转换下private string ConvertToString(int iType)
{
string sResult = "游戏";
switch(iType)
{
case 0:
sResult = "游戏";
break;
case 1:
sResult = "娱乐";
break;
}
return sResult;
}
{
string sResult = "游戏";
switch(iType)
{
case 0:
sResult = "游戏";
break;
case 1:
sResult = "娱乐";
break;
}
return sResult;
}
SELECT TYPENAME=CASE TYPE WHEN '0' THEN '游戏' WHEN '1' THEN '娱乐' ELSE '其他' END
FROM <TABLENAME>
FROM <TABLENAME>SQL里处理方便
string[] TypeNames = { "游戏", "娱乐", "其他", };
int Type = 2;
string strType = TypeNames[Type];
enum myEnum
{
游戏=0,
娱乐=1,
其他=2
}
myEnum e = myEnum.枚举2;
Console.WriteLine(e.ToString());