switch statement executes a set of logic depending on the value of a given parameter.
The types of the values a switch statement operates on can be booleans, enums, integral types, and strings.
Following is the example.
switch( strName)
{
case "james": strResult="male"; break;
case "jane": strResult="female"; break;
default: strResult = "unkonwn"; break;
}
{
case "james": strResult="male"; break;
case "jane": strResult="female"; break;
default: strResult = "unkonwn"; break;
}
Another posts included in "C#"
| How to get process id in C# like windows task manager ? (0) | 2009/10/15 |
| How to implement while loop in C# ? (0) | 2009/09/05 |
| How to delete file ? (0) | 2009/09/04 |
| How to convert integer to text string ? (0) | 2009/09/04 |
| How to convert text string to integer ? (0) | 2009/09/04 |
| How to set an certain color as transparent color on bitmap (0) | 2009/09/03 |

Prev

Rss Feed