Share via


ConversionHelpers.ToDouble(Object, CultureInfo, Double) Method

Definition

Converts value to a Double.

public static double ToDouble (object value, System.Globalization.CultureInfo culture, double defaultValue = NaN);
static member ToDouble : obj * System.Globalization.CultureInfo * double -> double
Public Shared Function ToDouble (value As Object, culture As CultureInfo, Optional defaultValue As Double = NaN) As Double

Parameters

value
Object

The value to convert.

culture
CultureInfo

If value is a string, InvariantCulture is first passed as the second parameter to to ToDouble(Object, IFormatProvider) to attempt to convert the string to a Double.

If that conversion fails, then this culture is passed as the second parameter to to ToDouble(Object, IFormatProvider) to attempt to convert the string to a Double.

defaultValue
Double

The value to return if value cannot be converted to a Double

Returns

The converted value. If the conversion fails, defaultValue is returned.

Applies to