private void encodeArray(MemoryStream ms, BSONArray lst) { var obj = new BSONObject(); for (int i = 0; i < lst.Count; ++i) { obj.Add(Convert.ToString(i), lst[i]); } this.encodeDocument(ms, obj); }
private BSONObject decodeDocument() { int length = this.mBinaryReader.ReadInt32() - 4; BSONObject obj = new BSONObject(); int i = (int)this.mBinaryReader.BaseStream.Position; while (this.mBinaryReader.BaseStream.Position < i + length - 1) { BSONValue value = this.decodeElement(out string name); obj.Add(name, value); } this.mBinaryReader.ReadByte(); // zero return(obj); }