Partager via


DataParameter.TryConvertValue Method

Attempts to convert the specified value to the specified type.

Namespace:  Microsoft.VisualStudio.Data
Assembly:  Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)

Syntax

'Déclaration
Protected Overridable Function TryConvertValue ( _
    value As Object, _
    type As String _
) As Object
protected virtual Object TryConvertValue(
    Object value,
    string type
)
protected:
virtual Object^ TryConvertValue(
    Object^ value, 
    String^ type
)
abstract TryConvertValue : 
        value:Object * 
        type:string -> Object 
override TryConvertValue : 
        value:Object * 
        type:string -> Object 
protected function TryConvertValue(
    value : Object, 
    type : String
) : Object

Parameters

Return Value

Type: System.Object
Returns the converted value, or returns nulla null reference (Nothing in Visual Basic) if no conversion was possible.

Remarks

This method is called by the base implementation of OnTypeChanged to attempt to convert any currently set parameter value to the new type. The method should handle any value input, including Value and nulla null reference (Nothing in Visual Basic).

In the case of DBNull, the method should simply return DBNull is the converted value. In the case of nulla null reference (Nothing in Visual Basic), it should return nulla null reference (Nothing in Visual Basic).

The base implementation of this method handles the DBNull case and returns nulla null reference (Nothing in Visual Basic) for all other cases.

.NET Framework Security

See Also

Reference

DataParameter Class

Microsoft.VisualStudio.Data Namespace