19 using System.Collections.Generic;
    29         private readonly Stream Stream;
    53             writeByte((
byte)(b ? 1 : 0));
    70             ulong n = (ulong)((value << 1) ^ (value >> 63));
    71             while ((n & ~0x7FUL) != 0)
    73                 writeByte((
byte)((n & 0x7f) | 0x80));
    87             byte[] buffer = BitConverter.GetBytes(value);
    88             if (!BitConverter.IsLittleEndian) Array.Reverse(buffer);
    99             long bits = BitConverter.DoubleToInt64Bits(value);
   101             writeByte((
byte)((bits) & 0xFF));
   102             writeByte((
byte)((bits >> 8) & 0xFF));
   103             writeByte((
byte)((bits >> 16) & 0xFF));
   104             writeByte((
byte)((bits >> 24) & 0xFF));
   105             writeByte((
byte)((bits >> 32) & 0xFF));
   106             writeByte((
byte)((bits >> 40) & 0xFF));
   107             writeByte((
byte)((bits >> 48) & 0xFF));
   108             writeByte((
byte)((bits >> 56) & 0xFF));
   130             WriteBytes(System.Text.Encoding.UTF8.GetBytes(value));
   177             Stream.Write(data, start, len);
   180         private void writeBytes(
byte[] bytes)
   182             Stream.Write(bytes, 0, bytes.Length);
   185         private void writeByte(
byte b)
 
void WriteString(string value)
A string is encoded as a long followed by that many bytes of UTF-8 encoded character data.
 
BinaryEncoder(Stream stream)
 
void WriteInt(int value)
int and long values are written using variable-length, zig-zag coding.
 
void WriteNull()
null is written as zero bytes
 
void WriteFloat(float value)
A float is written as 4 bytes.
 
void WriteFixed(byte[] data)
 
void WriteBoolean(bool b)
true is written as 1 and false 0.
 
void SetItemCount(long value)
 
void WriteFixed(byte[] data, int start, int len)
 
void WriteEnum(int value)
 
void WriteUnionIndex(int value)
 
void WriteLong(long value)
int and long values are written using variable-length, zig-zag coding.
 
void WriteDouble(double value)
A double is written as 8 bytes.
 
void WriteBytes(byte[] value)
Bytes are encoded as a long followed by that many bytes of data.