Pages

Subscribe:

Ads 468x60px

Tuesday, March 13, 2012

how to use The switch Statement in asp.net using c#

In this web programming tutorial we will learn that how we can use switch statement in asp.net using c#.
C# also provides a switch statement that you can use to evaluate a single variable or expression
for multiple possible values. The only limitation is that the variable you’re evaluating

must be an integer-based data type, a bool, a char, a string, or a value from an enumeration.
Other data types aren’t supported.
In the following code, each case examines the myNumber variable and tests whether it’s
equal to a specific integer:
switch (myNumber)
{
case 1:
// Do something.
break;
case 2:
// Do something.
break;
default:
// Do something.
break;
}

No comments:

Post a Comment