微軟開源跨平臺序列化庫:Bond
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); } }
}</pre>
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!