Current .Net Version: 1.1.4322
Home
Articles
Practice C# Online
C# Reference
XML Web Services
RSS Feeds
T-SQL Scripts
Videos
Valuable Links
Contact Us
Mike's C#, VS.NET and SQL Blog
ROR XML Info.
C# Reference
The world's largest C# Language & Framework Class Library Reference Database (second only to Microsoft's)!
Language Reference:
Language Search:
Framework Class Library Reference:
Framework Class Library Search:

switch
Is a:Statement Keyword
Applies to Version:C# 1.0 and later
Namespace:N/A
Assembly:N/A (N/A)
Description:A control statement that takes an integer or string expression and passes control to one of the case statements based on the evaluated expression value.
Syntax:
switch (expression)
{
   case constant-expression:
      statement
      jump-statement
   [default:
      statement
      jump-statement]
}
Example(s):int i = 1; switch (i) // returns an int value { case 1: MessageBox.Show("It's 1."); break; case 2: MessageBox.Show("It's 2."); break; }
 
COPYRIGHT/DISCLAIMER | CONTACT US