On Wed, 04 Jun 2008 00:48:00 -0700, AA2e72E
<AA*****@discussions.microsoft.comwrote:
I am getting this error with a switch statement: what doe it mean?
It means that the type used in the switch() statement is required to be an
"integral" type. As in "integer". As in NOT "array of integers".
The switch() statement simply does not work with complex types. Anything
that can be represented as a simple integer value is fine. Anything else
is pretty much not, with the exception of strings.
An equivalent to what it _appears_ you are doing would be this:
switch (arg1 is string ? "1" : "0" + arg2 is string ? "1" : "0")
{
case "00":
break;
case "01":
break;
// etc.
}
Now, that said...given that we're dealing with only four different
possibilities here, and given that it seems likely to me that arguments
that are actually strings are likely to be handled in similar ways to each
other, it might make more sense to just handle each argument individually.
I mean, does the code that depends on whether arg1 is a string _really_
affect how you use arg2, and vice a versa? Unless each case statement has
code that's radically different from every other case statement, I think a
switch() statement is probably not the right construct to use here.
Pete