Click or drag to resize

BinarySerializer Class

Serializes data into .NET specific byte sequence.
Inheritance Hierarchy

Namespace:  Eneter.Messaging.DataProcessing.Serializing
Assembly:  Eneter.Messaging.Framework (in Eneter.Messaging.Framework.dll) Version: (
public class BinarySerializer : ISerializer

The BinarySerializer type exposes the following members.

Public methodBinarySerializer
Constructs the binary serializer.
Public methodBinarySerializer(Boolean)
Constructs the binary serializer with a possibility to enforce deserialization into desired type.
Public methodDeserialize_T
Deserializes data into the specified type.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSerialize_T
Serializes data to the sequnce of bytes, byte[].
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
The serializer internally uses BinaryFormatter provided by .Net. The data is serialized in the binary format.
Serialization and deserialization example.
// Some class to be serialized.
public class MyClass
    public int Value1 { get; set; }
    public string Value2 { get; set; }


MyClass c = new MyClass;
c.Value1 = 10;
c.Value2 = "Hello World.";


// Serialization
BinarySerializer aSerializer = new BinarySerializer();
object aSerializedObject = aSerializer.Serialize<MyClass>(c);


// Deserialization
BinarySerializer aSerializer = new BinarySerializer();
object aDeserializedObject = aSerializer.Deserialize<MyClass>(aSerializedObject);
See Also