微软开源跨平台序列化库:Bond

jopen 10年前

Bond 是一个结构数据的可扩展框架,适合从服务通信到大数据的存储和处理的应用场景,通过可插拔序列化协议,数据流,用户定义的类型等等高度扩展它的功能,与语言和平台无关,支持C++,C sharp和Python。

namespace Examples  {      using Bond;      using Bond.Protocols;      using Bond.IO.Safe;        class Program      {          static void Main()          {              var src = new Example              {                  Name = "FooBar",                  Constants = { 3.14, 6.28 }              };                var output = new OutputBuffer();              var writer = new CompactBinaryWriter<OutputBuffer>(output);                // The first calls to Serialize.To and Deserialize<T>.From can take              // a relatively long time because they generate the de/serializer               // for a given type and protocol.              Serialize.To(writer, src);                var input = new InputBuffer(output.Data);              var reader = new CompactBinaryReader<InputBuffer>(input);                var dst = Deserialize<Example>.From(reader);          }      }  }


项目主页:http://www.open-open.com/lib/view/home/1420900621453