static void Main(string[] args)
{
Stopwatch obj=new Stopwatch();
obj.Start();
for(int i=0;i<10000;i++)
{
string str=getdesignation('M');
}
obj.Stop();
console.WriteLine(obj.ElaspsedTicks.ToString());
}
When user login mostly give top wrost performance
public static string getdesignation(char c)
{
if(c=="M")
return "Manager";
else if(c=="W")
return "Worker";
}
{
Stopwatch obj=new Stopwatch();
obj.Start();
for(int i=0;i<10000;i++)
{
string str=getdesignation('M');
}
obj.Stop();
console.WriteLine(obj.ElaspsedTicks.ToString());
}
When user login mostly give top wrost performance
public static string getdesignation(char c)
{
if(c=="M")
return "Manager";
else if(c=="W")
return "Worker";
}
Increase Performance:
public static string getdesignation(char c)
{
if(c=="W")
return "Worker";
else if(c=="M")
return "Manager";
}
{
if(c=="W")
return "Worker";
else if(c=="M")
return "Manager";
}