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