Compartilhar via


DataParameter.TryConvertValue Method

Attempts to convert the specified value to the specified type.

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

Syntax

'Declaration
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
The converted value, or nulla null reference (Nothing in Visual Basic) if no conversion is 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. In the case of null, it should return null.

The base implementation of this method handles the DBNull case and returns null for all other cases.

.NET Framework Security

See Also

Reference

DataParameter Class

Microsoft.VisualStudio.Data.Framework Namespace