+ 1
How can use switch with array in C#
3 ответов
+ 12
I don't think so.
Switch is mostly used with int or char
+ 1
u cant use switch with array , according to MSDN switch can only used with bool , char , string , integral and other corresponding nullable type and enum but u can use one element from the array with switch
+ 1
int[] a = new int[] { 1, 2, 3, 5 };
switch (a[1])
{
case 1:Console.WriteLine("1");
break;
}