我有这个枚举:
enum ControlsId
{
f1,
f2
}
Run Code Online (Sandbox Code Playgroud)
我想从函数返回枚举类型,如下所示:
public enum GetPostBackControlId(string str)
{
if(str = "btn1")
return ControlsId.f1
if(str = "btn2")
return ControlsId.f2
}
Run Code Online (Sandbox Code Playgroud)
是否可以从方法返回枚举?
public ControlsId GetPostBackControlId(string str)
{
if(str == "btn1")
{
return ControlsId.f1;
}
else if(str == "btn2")
{
return ControlsId.f2;
}
return (ControlsId)17;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
59 次 |
最近记录: |