Skip to content
yfakariya edited this page Aug 9, 2015 · 4 revisions

MessagePack is interoperable binary encoding format. You can reduce the size of stream dramatically when you have a data of which contains many binary (for example, numeric) data.

Usage

It's simple. Create, do, done.

There are only 2 steps to serialize types.

  1. Invoke MessagePackSerializer.Get<T>() where T is the type of the root object you're serialising. This returns you a MessagePackSerializer<T> object.
  2. Invoke Pack() or Unpack() on the serialiser.

A small sample is here:

[C#]

varserializer=MessagePackSerializer.Get<Foo>();serializer.Pack(stream,foo);stream.Position=0;varvalue=serializer.Unpack(stream);

[Visual Basic]

Dimserializer=MessagePackSerializer.Get(OfFoo)()serializer.Pack(stream,foo)stream.Position=0Dimvalue=serializer.Unpack(stream)

Note: Of course, you must add assembly reference to MsgPack.dll to your project.

Clone this wiki locally