My code is a service that needs to output different status codes as follows:
if(something is valid)
{
if(this is found)
return "200";
else
return 300;
}
else
return "100";
There are many such status codes and also occur at various places in the application. So, I would like to declare them as constants at one place and use them, so as not to hard code the strings.
something like
public struct StatusCodes
{
public static string 100 = "100";
public static string 200 = "200";
}
and be able to use it as
else return StatusCodes.100
Is there a standard practice or a good way to do so.