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