Created
September 22, 2012 14:52
-
-
Save CalvinRodo/3766423 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.Runtime.CompilerServices | |
Module DBNullExtensions | |
<Extension()> | |
Public Function Coalesce(of T as {New})(obj as Object, alt as T) as T | |
If (obj is DBNull.Value) Then | |
return alt | |
End If | |
Return Cast(obj, T) | |
End Function | |
End Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment