string to enum 字符串转枚举

string serverAction="设置";

ServerAction sAction = (ServerAction)Enum.Parse(typeof(ServerAction), serverAction);
if (Enum.IsDefined(typeof(ServerAction), sAction))
{
//ok
}

posted @ 2012-12-11 11:08  94cool  阅读(397)  评论(0编辑  收藏  举报