Skip to content

Latest commit

 

History

History
51 lines (43 loc) · 1.57 KB

README.md

File metadata and controls

51 lines (43 loc) · 1.57 KB

A Hessian binary protocol

Build Status Nuget Versions

This is implementation of Hessian 2.0 Web Service Protocol serializer for the .NET in the C#.

Description

This implementation is binary protocol serializer. It can serialize/deserialize simple value-types and complex object graphs. For example, we has class:

[DataContract]
public sealed class DummyClass {
  [DataMember(Name = "field")]
  public string Field1
  {
    get;
    set;
  }
}

Serializing the object graph

var graph = new DummyClass
{
  Field1 = "Lorem Ipsum"
};

var settings = new HessianSerializerSettings();
var serializer = new DataContractHessianSerializer(typeof(DummyClass), settings);

using (var stream = new MemoryStream())
{
  serializer.WriteObject(stream, graph);
}

Deserializing the object graph

var settings = new HessianSerializerSettings();
var serializer = new DataContractHessianSerializer(typeof(DummyClass), settings);

// your data retrieval goes here
var packet = new byte[...];

using (var stream = new MemoryStream(packet))
{
  var graph = (DummyClass) serializer.ReadObject(stream);
}

Links