Interface IBinaryAdapter<TValue>
Implement this interface to override serialization and deserialization behaviour for a given type.
Namespace: Unity.Serialization.Binary.Adapters.Contravariant
Syntax
public interface IBinaryAdapter<in TValue> : IBinaryAdapter
Type Parameters
| Name | Description |
|---|---|
| TValue | The type to override serialization for. |
Methods
Deserialize(UnsafeAppendBuffer.Reader*)
Invoked during deserialization to handle reading the specified TValue.
Declaration
object Deserialize(UnsafeAppendBuffer.Reader*reader)
Parameters
| Type | Name | Description |
|---|---|---|
| UnsafeAppendBuffer.Reader* | reader | The stream to read from. |
Returns
| Type | Description |
|---|---|
| Object | The deserialized value. |
Serialize(UnsafeAppendBuffer*, TValue)
Invoked during serialization to handle writing out the specified TValue.
Declaration
void Serialize(UnsafeAppendBuffer*writer, TValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| UnsafeAppendBuffer* | writer | The stream to write to. |
| TValue | value | The value to write. |