String - IsNullOrEmpty

A string extension method that queries if the string object is null or is empty.

Try it

public static void Main()
{
	string [] values = {"EntityFramework", "    ", "SQL", "", "Java", null};

	foreach(var str in values)
	{
		// C# Extension Method: String - IsNullOrEmpty
    	if(!str.IsNullOrEmpty())
		{
			Console.WriteLine(str);
		}
	}
}

View Source
public static partial class Extensions
{
    /// <summary>
    ///     A string extension method that queries if '@this' is null or is empty.
    /// </summary>
    /// <param name="this">The @this to act on.</param>
    /// <returns>true if '@this' is null or is empty, false if not.</returns>
    public static bool IsNullOrEmpty(this string @this)
    {
        return string.IsNullOrEmpty(@this);
    }
}