I have this method
public enum Values
{
True= true,
False=false
};
public static string GetValues(bool values)
{
string status = "";
switch (values)
{
case(bool)UIHelper.Values.False:
}
}
I want to have this enum
as boolean
. It says, that:
Values cannot be casted as bool.
How can I do it so I can have it boolean
?
Of course, you can map to 0 (Service
) and 1 (Serial
), but why map to that in the first place? Why not use bool from the start?
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:
}
}