Swicth Statement in C#7
New Way of Switch Statement
private string GetDefaultMessage(int statusCode)
{
return statusCode switch
{
400 => "Bad Request",
401 => "Unauthorized",
404 => "Not Found",
500 => "Internal Server Error",
_ => null
};
}
Comments
Post a Comment