static void Main(string[] args) { MessagePackSerializerOptions lz4Options = MessagePackSerializerOptions.Standard.WithCompression( MessagePackCompression.Lz4Block ); var ro = new TestMessageWithReadOnlyProperty(); byte[] serialized = MessagePackSerializer.Serialize(ro, lz4Options); Console.WriteLine($"Message with read-only property serializes to: {ByteArrayToString(serialized)}"); var rw = new TestMessageWithReadWriteProperties(); serialized = MessagePackSerializer.Serialize(rw, lz4Options); Console.WriteLine($"Message with read-write properties serializes to: {ByteArrayToString(serialized)}"); var get = new TestMessageWithGetter(); serialized = MessagePackSerializer.Serialize(get, lz4Options); Console.WriteLine($"Message with constant properties as getters serializes to: {ByteArrayToString(serialized)}"); }
static void Main(string[] args) { var ro = new TestMessageWithReadOnlyProperty(); byte[] serialized = MessagePackSerializer.Serialize(ro); Console.WriteLine($"Message with read-only property serializes to: {ByteArrayToString(serialized)}"); var rw = new TestMessageWithReadWriteProperties(); serialized = MessagePackSerializer.Serialize(rw); Console.WriteLine($"Message with read-write properties serializes to: {ByteArrayToString(serialized)}"); var get = new TestMessageWithGetter(); serialized = MessagePackSerializer.Serialize(get); Console.WriteLine($"Message with constant properties as getters serializes to: {ByteArrayToString(serialized)}"); }