我有这个方法
public enum Values
{
True= true,
False=false
};
public static string GetValues(bool values)
{
string status = "";
switch (values)
{
case(bool)UIHelper.Values.False:
}
}
Run Code Online (Sandbox Code Playgroud)
我想把它enum作为boolean. 它说:
值不能转换为 bool。
我该怎么做才能拥有它boolean?
当然,您可以映射到 0 ( Service) 和 1 ( Serial),但为什么首先映射到那个?为什么不从一开始就使用 bool 呢?
public static class UnlPointValues
{
public const bool Serial = true;
public const bool Service = false;
}
public static string GetUnloadingPointValues(bool values)
{
string status = "";
switch (values)
{
case UIHelper.UnlPointValues.Serial:
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19800 次 |
| 最近记录: |