-
Notifications
You must be signed in to change notification settings - Fork 174
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>()
whereT
is 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#]
var serializer = MessagePackSerializer.Get<Foo>();
serializer.Pack(stream, foo);
stream.Position = 0;
var value = serializer.Unpack(stream);
[Visual Basic]
Dim serializer = MessagePackSerializer.Get(Of Foo)()
serializer.Pack(stream, foo)
stream.Position = 0
Dim value = serializer.Unpack(stream)
Note: Of course, you must add assembly reference to MsgPack.dll
to your project.