Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# switch

// switch..case with string
void StringSwitchCase()
{
   string name = "Mahesh";
   switch (name)
   {
   case "Mahesh":
      Console.WriteLine("First name was used!");
   break;
   case "Chand":
      Console.WriteLine("Last name was used!");
   break;
   default:
      Console.WriteLine("No name found!");
   break;
   }
}
Source by www.c-sharpcorner.com #
 
PREVIOUS NEXT
Tagged: #switch
ADD COMMENT
Topic
Name
1+3 =