Skip to main content
Version: 0.3.x (0.3.0)

Class ValueObjectProtoSerializer<TSelf, TValue>

Namespace: AdCodicem.ValueObjects.ProtobufNet
Assembly: AdCodicem.ValueObjects.ProtobufNet.dll

Writes a value object as protobuf-net writes its underlying type at , and reads it back through its rules.

public sealed class ValueObjectProtoSerializer<TSelf, TValue> : ISerializer<TSelf>, ISerializer<TSelf?> where TSelf : struct, IValueObject<TSelf, TValue>

Type Parameters​

TSelf

Value object type.

TValue

Underlying value type.

Inheritance​

object ← ValueObjectProtoSerializer<TSelf, TValue>

Implements​

ISerializer<TSelf>, ISerializer<TSelf?>

Inherited Members​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks​

The strict profile at protobuf-net's default level, : the same as closed over it, under a shorter name for [ProtoContract(Serializer = typeof(ValueObjectProtoSerializer<Sku, string>))].

Properties​

Features​

Indicates the features (including the default wire-type) for this type/serializer

public SerializerFeatures Features { get; }

Property Value​

SerializerFeatures

Exceptions​

NotSupportedException

protobuf-net has no inbuilt serializer for TValue.

Methods​

Read(ref State, TSelf)​

Deserialize an instance from the supplied writer

public TSelf Read(ref ProtoReader.State state, TSelf value)

Parameters​

state ProtoReader.State

value TSelf

Returns​

TSelf

Exceptions​

ProtoException

The value read is one the inbuilt serializer of the underlying type cannot read, or one the value object refuses.

Write(ref State, TSelf)​

Serialize an instance to the supplied writer

public void Write(ref ProtoWriter.State state, TSelf value)

Parameters​

state ProtoWriter.State

value TSelf

Exceptions​

ProtoException

value equals default(TSelf) and holds a value the value object rejects.