[This is preliminary documentation and is subject to change.]
Assembly: Tools (in Tools.dll) Version: 1.5.3.38916 (1.5.3.38916)
Syntax
| C# |
|---|
protected virtual TypeConverter<(Of <(<'T>)>)>..::..dConvertFrom ConverterFrom( Type sourceType ) |
| Visual Basic |
|---|
Protected Overridable Function ConverterFrom ( _ sourceType As Type _ ) As TypeConverter<(Of <(<'T>)>)>..::..dConvertFrom |
| Visual C++ |
|---|
protected: virtual TypeConverter<(Of <(<'T>)>)>..::..dConvertFrom^ ConverterFrom( Type^ sourceType ) |
| F# |
|---|
abstract ConverterFrom : sourceType:Type -> TypeConverter<(Of <(<'T>)>)>..::..dConvertFrom override ConverterFrom : sourceType:Type -> TypeConverter<(Of <(<'T>)>)>..::..dConvertFrom |
| JScript |
|---|
protected function ConverterFrom( sourceType : Type ) : TypeConverter<(Of <(<'T>)>)>..::..dConvertFrom |
Parameters
- sourceType
- Type: System..::..Type
Type of TypeConverter<(Of <(<'T>)>)>..::..ITypeConverterFrom<(Of <(<'TOther>)>)> to search for
Return Value
TypeConverter<(Of <(<'T>)>)>..::..dConvertFrom delegate that invokes appropriate TypeConverter<(Of <(<'T>)>)>..::..ITypeConverterFrom<(Of <(<'TOther>)>)>..::..dConvertFrom delegate function that performs conversion
Remarks
This function first searchse for sourceType implementation of TypeConverter<(Of <(<'T>)>)>..::..ITypeConverterFrom<(Of <(<'TOther>)>)> interface. If it is not found it searches for implementation of any interface implemented by sourceType and then for any base class of sourceType
Note for inheritors: This function uses reflection, so it is not very efficient. You can improve an efficiency by overriding this function and returning required delegate. If you want to keep semantics of this function (delegates are automatically found) for classses derived from yours one call base class function ConverterFrom(Type) if you are asked for delegate for type that you don't provide converter of. Because your implementation has signature of TypeConverter<(Of <(<'T>)>)>..::..ITypeConverterFrom<(Of <(<'TOther>)>)>..::..dConvertFrom and you need signature of TypeConverter<(Of <(<'T>)>)>..::..dConvertFrom you should youse TypeConverter<(Of <(<'T>)>)>..::..DAdaptor<(Of <(<'TOther>)>)> to adapt your delegate and return delegate to ConvertFrom(ITypeDescriptorContext, CultureInfo, Object).