IsNull extension method for C# and VB.NET.
Simple but very usefull!

Sample C#

public static bool IsNull(this object input)
{
    return input== null;
}

Sample VB.NET

<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsNull(input As Object) As Boolean
	Return input Is Nothing
End Function

Usage (c#)

if (!myObject.IsNull())
{
	// do something
}

One thought on “IsNull extension method for C# and VB.NET”

Leave a Reply