Click or drag to resize

DataConverterGetConvertTo Method

Returns a function that converts the given value to the specified type, using the specified context.

Namespace:  Demo3D.PLC.Comms
Assembly:  PLC (in PLC.dll) Version: 15.0.2.11458
Syntax
C#
public virtual ConversionFunction? GetConvertTo(
	IDataContextProvider? contextProvider,
	DataType destinationType,
	DataType sourceType
)

Parameters

contextProvider
Type: Demo3D.PLC.CommsIDataContextProvider
Conversion context provider (or null).
destinationType
Type: Demo3D.PLC.CommsDataType
The data type to convert to.
sourceType
Type: Demo3D.PLC.CommsDataType
The data type to convert from.

Return Value

Type: ConversionFunction
The conversion function, or null.
Remarks

You can assume that the value passed to the conversion function is non-null and is an instance of the type that this data converter is registered/associated with.

When setting up a conversion, the contextProvider passed to this function must be the same provider that was passed to CanConvertTo(IDataContextProvider, DataType, DataType), and the same provider must aslso be passed to the ConversionDelegate returned.

Each instance of the IDataContextProvider is supposed to provide the context for one particular conversion for one particular data stream.

See Also