private void encodeElement(MemoryStream ms, string name, BSONValue v) { switch (v.valueType) { case BSONValue.ValueType.Double: ms.WriteByte(0x01); this.encodeCString(ms, name); this.encodeDouble(ms, v.doubleValue); return; case BSONValue.ValueType.String: ms.WriteByte(0x02); this.encodeCString(ms, name); this.encodeString(ms, v.stringValue); return; case BSONValue.ValueType.Object: ms.WriteByte(0x03); this.encodeCString(ms, name); this.encodeDocument(ms, v as BSONObject); return; case BSONValue.ValueType.Array: ms.WriteByte(0x04); this.encodeCString(ms, name); this.encodeArray(ms, v as BSONArray); return; case BSONValue.ValueType.Binary: ms.WriteByte(0x05); this.encodeCString(ms, name); this.encodeBinary(ms, v.binaryValue); return; case BSONValue.ValueType.Boolean: ms.WriteByte(0x08); this.encodeCString(ms, name); this.encodeBool(ms, v.boolValue); return; case BSONValue.ValueType.UTCDateTime: ms.WriteByte(0x09); this.encodeCString(ms, name); this.encodeUTCDateTime(ms, v.dateTimeValue); return; case BSONValue.ValueType.None: ms.WriteByte(0x0A); this.encodeCString(ms, name); return; case BSONValue.ValueType.Int32: ms.WriteByte(0x10); this.encodeCString(ms, name); this.encodeInt32(ms, v.int32Value); return; case BSONValue.ValueType.Int64: ms.WriteByte(0x12); this.encodeCString(ms, name); this.encodeInt64(ms, v.int64Value); return; } }
public bool Remove(BSONValue v) { return(this.mList.Remove(v)); }
public override bool Contains(BSONValue v) { return(this.mList.Contains(v)); }
public int IndexOf(BSONValue item) { return(this.mList.IndexOf(item)); }
public void Insert(int index, BSONValue item) { this.mList.Insert(index, item); }
public bool TryGetValue(string key, out BSONValue value) { return(this.mMap.TryGetValue(key, out value)); }
// Methods public override void Add(BSONValue v) { this.mList.Add(v); }
public override bool Contains(BSONValue v) { return(this.mMap.ContainsValue(v)); }
public override void Add(string key, BSONValue value) { this.mMap.Add(key, value); }
public virtual bool Contains(BSONValue v) { return(false); }
public virtual void Add(BSONValue value) { }
public virtual void Add(string key, BSONValue value) { }