So I have a switch statement that takes single or double character input from the user (what it is can vary due to i18n concerns), and displays Strings that also vary because of i18n.
I’ve got Kotlin/Android code that does this fine. But in C# I am being flummoxed by the fact the left side of a case in a switch statement requires an expression that can be evaluated at compile time.
So I cannot do something like the following with Strings defined in various languages’.resx file evens if I use ResXCodeFileGenerator to generate string variables from them (because ultimately the value is determined at runtime). It seems strings I refer to here need to be defined a const, or something akin to that.
switch (input)
{
case Strings.PassInput:
output = Strings.PassOutput;
break;
...
}
Is there a usual way around this problem? I can’t believe I’m the first