示例#1
0
        public static void MarshalSP <T>(T obj, Stream stream)
        {
            var output = new OutputStream(stream, 11);
            var writer = new SimpleBinaryWriter <OutputStream>(output);

            Marshal.To(writer, obj);
            output.Flush();
        }
示例#2
0
        public static ArraySegment <byte> MarshalCB <T>(T obj)
        {
            var output = new OutputBuffer(new byte[11]);
            var writer = new CompactBinaryWriter <OutputBuffer>(output);

            Marshal.To(writer, obj);
            return(output.Data);
        }
示例#3
0
        public static ArraySegment <byte> MarshalFB <T>(T obj)
        {
            var output = new OutputBuffer();
            var writer = new FastBinaryWriter <OutputBuffer>(output);

            Marshal.To(writer, obj);
            return(output.Data);
        }
示例#4
0
        public static void MarshalCB2 <T>(T obj, Stream stream)
        {
            var output = new OutputStream(stream, 11);
            var writer = new CompactBinaryWriter <OutputStream>(output, 2);

            Marshal.To(writer, obj);
            output.Flush();
        }