您好,我正在使用枚举转换为字符串并带有switch语句,但它无法正常工作。它会出现编译错误:Cannot implicitly convert type 'userControl_commontop.UserType' to 'string'
代码如下:
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
}