Class Serializer
- Namespace
- nanoFramework.Protobuf
- Assembly
- nanoFramework.Protobuf.dll
The Serializer class providing serialization and deserialization capabilities
public class Serializer : IAmASerializer
- Inheritance
-
Serializer
- Implements
- Inherited Members
- Extension Methods
Constructors
Serializer()
Initializes an instance of Serializer. This defaults to using a MemoryStream internally
public Serializer()
Serializer(StreamType)
Initializes an instance of Serializer
public Serializer(StreamType streamType)
Parameters
streamTypeStreamTypeThe stream type to use. MemoryStream is the preferred option, ProtobufStream is there to support payloads > 65kB.
Methods
Deserialize(Type, byte[])
Deserializes a byte array to the given type
public object Deserialize(Type type, byte[] serialized)
Parameters
typeTypeThe type to deserialize to
serializedbyte[]The byte array containing the serialized payload
Returns
- object
An object graph of Type type
Deserialize<T>(byte[])
public T Deserialize<T>(byte[] serialized)
Parameters
serializedbyte[]
Returns
- T
Type Parameters
T
Serialize(object)
Serializes an object graph to a byte array
public byte[] Serialize(object obj)
Parameters
objobjectThe object graph to serialize
Returns
- byte[]
A byte array containing the serialized payload