when we have more than two conditional statement it always better to use switch case.
->compared to serise of "if else" statement better is switch case
->compared to serise of "if else" statement better is switch case
sample code:
public class days
{
days s= new days();
string dayname= d.GetName(s);
Response.Write("day name");
}
}
public class days
{
public string Getdaynames(int day)
{
switch(days)
{
case1:
return "mondays";
case1: return "mondays";
case2: return "tuesday";
case3: return "wednesday";
case4: return "thusday";
case5: return "fridays";
case6: return "saturedays";
case7: return "sundays";
}
No comments:
Post a Comment