ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

ToDbl

Handling null values for obejct

Source

<System.Runtime.CompilerServices.Extension()>
Public Function ToDbl(ByVal objValue As Object) As Double

    If IsDBNull(objValue) Then
        Return 0
    Else
        Return objValue
    End If

End Function

Example

Dim objAmount as object
objAmount.ToDbl()

Author: Vinayak

Submitted on: 25 jun. 2014

Language: VB

Type: System.Object

Views: 5556