C#, Serialize and deserialize, Protoco Buffer from google

0. The following content is from : https://developers.google.com/protocol-buffers/docs/overview

1. What are protocol buffers

Protocol buffers are a flexible, efficient, automated mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages. You can even update your data structure without breaking deployed programs that are compiled against the "old" format.

2. Ways of serialize and retrieve structured data

    1) use .NET binary serialization with System.Runtime.Serialization.Formatters.Binary.BinaryFormatter and associated classes.

    2) invent an ad-hoc way to encode the data items into a single string -- such as encoding 4 ints as "xx:xxx:xx:xxx".

    3) serialize the data to XML

    4) 

3.

原文地址:https://www.cnblogs.com/sarah-zhang/p/12407601.html