![]() | IValueWriter<T> Interface |
Namespace: Ookii.Jumbo.IO
The IValueWriter<T> type exposes the following members.
Name | Description | |
---|---|---|
![]() | Read |
Reads a value from the specified reader.
|
![]() | Write |
Writes the specified value to the specified writer.
|
Jumbo provides its own simple, light-weight serialization protocol that is primarily used by the BinaryRecordReader<T> and BinaryRecordWriter<T> classes (although it is also used in a few other places).
Normally, classes support this protocol by implementing the IWritable interface. However, the IWritable interface cannot be used on value types (structs) because of the semantics of calling interface methods that modify the object's state on a value type.
To provide serialization support for a value type, you must create a class implementing IValueWriter<T> for that value type, and mark the value type with the ValueWriterAttribute. Although you can use IValueWriter<T> for reference types as well, this is not recommended because IValueWriter<T> doesn't support record reuse.
Jumbo also provides IValueWriter<T> implementations for several built-in framework types.
To access the IValueWriter<T> implementation for a type, use the ValueWriter<T> class.