You can use the IsNull Extension method by using the snippet below.

Sample C#

public static bool IsNull(this object source)
     return source == null;

Sample VB.NET

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

As always, this extension method has been added to the Github Fesslersoft.Extensions Repository

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

Leave a Reply