djordjedjukic
12/22/2016 - 10:01 PM

Extension methods

Extension methods

public static string ToLowerSafe(this string input)
{
    return String.IsNullOrEmpty(input) ? input : input.ToLower();
}
public static int Int(this string stringValue, int defaultValue = 0)
{
    if (stringValue == null) return defaultValue;
    int integer = Int32.TryParse(stringValue, out integer) ? integer : defaultValue;
    return integer;
}