Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 176
Quick Start
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.
It's simple. Create, do, done.
There are only 2 steps to serialize types.
- Invoke
MessagePackSerializer.Get<T>()whereTis the type of the root object you're serialising. This returns you aMessagePackSerializer<T>object. - Invoke
Pack()orUnpack()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.