Version

ConvertValue Method (PrimitiveTypeConverter)

Returns a value converted to the specified type using the supplied culture.
Syntax
'Declaration
 
Public Function ConvertValue( _
   ByVal value As Object, _
   ByVal destinationType As Type, _
   ByVal culture As CultureInfo _
) As Object
public object ConvertValue( 
   object value,
   Type destinationType,
   CultureInfo culture
)

Parameters

value
Value to convert.
destinationType
Type that the value needs to be converted to.
culture
The culture to use for the conversion. If null then the curent culture is used.

Return Value

If the value can be converted to the specified type, the converted value will be returned. If the value is already of that type or cannot be converted to that type, the value will be returned; otherwise null is returned.
Exceptions
ExceptionDescription
System.ArgumentNullExceptionThrown when destinationType is null (Nothing in Visual Basic .NET).
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also