public void WriteEnumerableIndex(long idx, BinaryWriter writer)
 {
     if (EnumerableIndexBytes == 1)
     {
         writer.WriteByteValue((byte)idx);
     }
     else if (EnumerableIndexBytes == 2)
     {
         writer.WriteUInt16Value((ushort)idx);
     }
     else if (EnumerableIndexBytes == 4)
     {
         writer.WriteUInt32Value((UInt32)idx);
     }
     else if (EnumerableIndexBytes == 8)
     {
         writer.WriteUInt64Value((ulong)idx);
     }
     else
     {
         ThrowHelper.ThrowBinaryException();
     }
 }