ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

IsNotNullOrEmpty

Returns true when a given string is not null or empty

Source

public static bool IsNotNullOrEmpty(this string input) {
    return !String.IsNullOrEmpty(input);
}

Example

string a = "demo";
string b = string.Empty;
string c = null;

Console.WriteLine(a.IsNotNullOrEmpty()); // true
Console.WriteLine(b.IsNotNullOrEmpty()); // false
Console.WriteLine(c.IsNotNullOrEmpty()); // false

Author: unknown

Submitted on: 29 feb. 2008

Language: C#

Type: System.String

Views: 8514