嗨,我正在使用带有开关的枚举转换为字符串,但它不起作用。它给出了编译错误:无法将类型“userControl_commontop.UserType”隐式转换为“字符串”
代码是:
private void CommonTopChangesnew(string usertype)
{
switch (usertype.Trim().ToUpper())
{
case UserType.NORMAL :
hlkSAD.Enabled = false;
hlkMRTQuery.Enabled = false;
hlkReqViewer.Enabled = false;
hlkSendnotif.Enabled = false;
break;
case UserType.POWER :
hlkSAD.Enabled = false;
hlkReqViewer.Enabled = false;
hlkSendnotif.Enabled = false;
break;
}
}
enum UserType
{
NORMAL,
POWER,
ADMINISTRATOR
}