Uppercase with null check
Converts a string to upper-case but checks for null strings first
Source
public static String ToUpperCheckForNull(this string input)
{
string retval = input;
if (!String.IsNullOrEmpty(retval))
{
retval = retval.ToUpper();
}
return retval;
}
Example
string g = "potatoe";
return g.ToUpperCheckForNull();
will return "POTATOE"