B
Brett Romero
If I want to use:
switch (AppName)
{
case ApplicationName.App1:
loadApp1Logo();
break;
case ApplicationName.App2:
loadApp2Logo();
break;
}
I'll get a compiler error:
A constant value is expected
Which means I can't use the above enums. I don't want to hardcode the
AppName in the case statements. AppName is getting its value from the
same exact enums presented above.
I can easily get around this with If/elseif statements but the case
statements are cleaner code since I'll have a few conditions. Is there
a way to do this with case statements or some other better way?
Thanks,
Brett
switch (AppName)
{
case ApplicationName.App1:
loadApp1Logo();
break;
case ApplicationName.App2:
loadApp2Logo();
break;
}
I'll get a compiler error:
A constant value is expected
Which means I can't use the above enums. I don't want to hardcode the
AppName in the case statements. AppName is getting its value from the
same exact enums presented above.
I can easily get around this with If/elseif statements but the case
statements are cleaner code since I'll have a few conditions. Is there
a way to do this with case statements or some other better way?
Thanks,
Brett