ICustomDataTypeAdapter
Interface
Visual Basic
Public Interface ICustomDataTypeAdapter
C#
public interface ICustomDataTypeAdapter
Purpose
Interface for encoding and decoding custom datatypes.
|
Member |
Description |
|
Public Instance Properties |
||
|
Each adapter class must return the type designator corresponding to the type that it encodes and decodes. Type designators of custom datatypes must be in this inclusive range (the range constants are public static fields of Message): [MinimumCustomDataTypeIDMaximumCustomDataTypeID, MinimumCustomDataTypeIDMaximumCustomDataTypeID] Type designators must be consistent across all senders and receivers within a network environment. |
Get |
|
Method |
Description |
Page |
Remarks
Programs must implement this interface to automatically convert between custom datatypes and Rendezvous wire format.
To define a custom datatype, a program must do three steps:
Procedure
| 1. | Define the datatype class, indicating that it implements ICustomDataType. |
| 2. | Define an adapter that implements this ICustomDataTypeAdapter interface—including the TypeID property, and Decode and Encode methods. |
The encoder and decoder must implement inverse operators. That is, when the encoder encodes a .NET object as a byte array, the decoder must decode the byte array to an identical .NET object. Conversely, when the decoder decodes the byte array to a .NET object, the encoder must encode the .NET object as an identical byte array.
| 3. | Register the pairing of datatype and adapter. |