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

IsNull

This method returns true if the value is null otherwise it returns false

Source

public static bool IsNull<T>(this T input)
{
   var output = false;
   if(null == input)
   {
      output = true;
   }
   return output;
}

Example

StringBuilder stringBuilder = null;

if(stringBuilder.IsNull())
{
   //yeah, it's null
}

Author: Omkar Panhalkar

Submitted on: 7 mei 2012

Language: C#

Type: System.Type

Views: 3067