创建字典进行字段匹配
--查询
var postNumFiled = Static_Dic.RoleType_PostNum.FirstOrDefault(o => o.Key == roleType).Value;
--封装匹配的字典
public static Dictionary<int, string> RoleType_PostNum
{
get
{
Dictionary<int, string> dic = new Dictionary<int, string> { };
dic.Add(RoleType.MR.GetHashCode(), "PostNum");
dic.Add(RoleType.DM.GetHashCode(), "PostNum1");
dic.Add(RoleType.RM.GetHashCode(), "PostNum2");
dic.Add(RoleType.AD.GetHashCode(), "PostNum3");
dic.Add(RoleType.BUD.GetHashCode(), "PostNum4");
dic.Add(RoleType.CEO.GetHashCode(), "PostNum5");
return dic;
}
}
浙公网安备 33010602011771号