I am a C# beginner. I am asking for a simple example how to create 3 different categories of C# Arrays, for example:
- The first containing Groceries products,
- The second containing Electronics products
- And the third containing Apparel Products
Then be able to use Switch Case to interact with each Product Catalogue.
I will be thankful for you help.
Pankaj Kumar ChoudharyPosted May 14, 2015, 9:41 PM
Array Groceries_products = new Array[10];
Array Electronics_products = new Array[10];
Array Apparel_Products = new Array[10];
int ch=0;
while (ch!=4)
{
Console.WriteLine("Enter 1 for Groceries_products");
Console.WriteLine("Enter 2 for Electronics_products");
Console.WriteLine("Enter 3 for Apparel_Products");
Console.WriteLine("Enter 4 for Exit");
Console.WriteLine("Enter Your Choice");
int.TryParse(Console.ReadLine(),out ch);
switch (ch)
{
case 1:
//Write Code Here For Groceries_products Array
break;
case 2:
//Write Code Here For Electronics_products Array
break;
case 3:
//Write Code Here For Apparel_Products Array
break;
case 4:
break;
}
}
you can make any change in this code as your requirement. i can't understand actually what do you need only i give a demo of switch . ...
if you have query then you can explain that for better understanding ....
Dipankar BiswasPosted May 14, 2015, 2:57 PM
Check this link to help...http://stackoverflow.com/questions/2147413/how-to-use-array-value-for-case-switching-not-array-number