Skip to content

Instantly share code, notes, and snippets.

@CalvinRodo
Created April 25, 2012 19:33
Show Gist options
  • Save CalvinRodo/2492616 to your computer and use it in GitHub Desktop.
Save CalvinRodo/2492616 to your computer and use it in GitHub Desktop.
A vb.net Coalesce Extension should be strictly typed.
Imports System.Runtime.CompilerServices
<Extension()>
Public Module GenericExtensions
Function Coalesce(Of T)(first As T, second As T) As T
If (first Is Nothing) Then
Return second
End If
Return first
End Function
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment