Пример #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();
        }