IsNull extension method for C# and VB.NET

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

How to check if String is Null or Empty in XSL

To check if String is Null or Empty in XSL you can use the following snippet.

Sample XSL

<xsl:choose>
    <xsl:when test="fieldToTest != ''">
        <xsl:value-of select="Field1Value" />
    </xsl:when>
    <xsl:otherwise>
        <xsl:value-of select="Field2Value" />
    </xsl:otherwise>
</xsl:choose>

IsNull extension method for C# and VB.NET

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
}