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
streamType
StreamTypeThe 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
type
TypeThe type to deserialize to
serialized
byte[]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
serialized
byte[]
Returns
- T
Type Parameters
T
Serialize(object)
Serializes an object graph to a byte array
public byte[] Serialize(object obj)
Parameters
obj
objectThe object graph to serialize
Returns
- byte[]
A byte array containing the serialized payload