Tip
public static void RegisterConversion(
this Type sourceType,
Type targetType,
Conversion conversion
)
<ExtensionAttribute>
Public Shared Sub RegisterConversion (
sourceType As Type,
targetType As Type,
conversion As Conversion
)
public:
[ExtensionAttribute]
static void RegisterConversion(
Type^ sourceType,
Type^ targetType,
Conversion^ conversion
)
[<ExtensionAttribute>]
static member RegisterConversion :
sourceType : Type *
targetType : Type *
conversion : Conversion -> unit
After calling this method the Convert/TryConvert Object extension methods and Parse/TryParse String extension methods will be able to use the registered conversion between sourceType and targetType.
Calling the RegisterConversion methods for the same source and target types multiple times will override the old registered conversion with the new one.
sourceType and targetType can be interface, abstract or even a generic type definition. Preregistered conversions: