c# simple switch
Feel l开发者_JAVA百科ike an idiot :) Why does this not work?
switch (sortCol)
{
case: "username"
mnu_username.Text = "";
break;
case default
break;
}
Thanks!
switch (sortCol)
{
case "username":
mnu_username.Text = "";
break;
default:
break;
}
Have you not got an IDE to highlight syntax errors for you?
Also note that if sortCol
is not a string, this won't work.
case default
should be changed to default:
. Then your switch statement should work.
switch (sortCol)
{
case "username":
mnu_username.Text = "<img src=\"../images/" + sortType + ".png\" class=\"adIco\" />";
break;
default:
break;
}
精彩评论