String - IsNotEmpty
A string extension method that queries if the string object is not empty.
public static void Main() { string [] values = {"EntityFramework", "", "SQL", "Java"}; foreach(var str in values) { // C# Extension Method: String - IsNotEmpty if(str.IsNotEmpty()) { Console.WriteLine(str); } } }
View Source
public static partial class Extensions { /// <summary> /// A string extension method that queries if a not is empty. /// </summary> /// <param name="this">The @this to act on.</param> /// <returns>true if a not is empty, false if not.</returns> public static bool IsNotEmpty(this string @this) { return @this != ""; } }