BCS wrote:
I think what retard was asking was what types are legal as the argument
for a switch?
IIRC the list is: all the arithmetic types and the string types.
The value pattern matching that is being asked for would allow just
about anything that has a compile time literal syntax:
void fn(int[] ar)
{
switch(ar)
{
case [1,2,3]: ... break;
case [1,2,4]: ... break;
case [1,3,2]: ... break;
}
}
I've thought more than once about adding that, but it just seems
pointless. I've never run into a use case for it. If you do run into one,
if (ar == [1,2,3]) ...
else if (ar == [1,2,4]) ...
else if (ar == [1,3,2]) ...
will work just fine.