public int Age { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public MyClass2 cl { get; set; }
public MyClass2 cl2 { get; set; }
public int Age { get; set; }
public string FirstName { get; set; }
public static void Main()
FirstName = "major, widely used binary-format library on .NET. I love protobuf-net and respect their great work. But when you use protobuf-net as a general purpose serialization format, you may encounter an annoying issue.",
LastName = "Lz4Block compresses an entire MessagePack sequence as a single LZ4 block. This is the simple compression that achieves best compression ratio, at the cost of copying the entire sequence when necessary to get contiguous memory.",
FirstName = "Regardless of which LZ4 option is set at the deserialization, both methods can be deserialized. For example, when the Lz4BlockArray option was used, binary data using either Lz4Block and Lz4BlockArray can be deserialized. Neither can be decompressed and hence deserialized when the compression option is set to None.",
FirstName = "MessagePack is a fast and compact format but it is not compression. LZ4 is an extremely fast compression algorithm, and using it MessagePack for C# can achieve extremely fast performance as well as extremely compact binary sizes!",
var options = MessagePackSerializerOptions.Standard.WithSecurity(MessagePackSecurity.UntrustedData);
MessagePackSerializer.DefaultOptions = options;
var lz4Options = MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray);
byte[] bytes = MessagePackSerializer.Serialize(mc);
byte[] bytes2 = MessagePackSerializer.Serialize(mc, lz4Options);
MyClass mc2 = MessagePackSerializer.Deserialize<MyClass>(bytes);
Console.WriteLine($"size - {bytes.Length}");
Console.WriteLine($"size - {bytes2.Length}");
var json = MessagePackSerializer.ConvertToJson(bytes);
Console.WriteLine($"size - {json.Length}");
string jsonString = JsonSerializer.Serialize(mc);
Console.WriteLine($"size - {jsonString.Length}");