/// <summary> /// Removes an element from this document. /// </summary> /// <param name="element">The element to remove.</param> public override void RemoveElement(BsonElement element) { EnsureIsMaterialized(); base.RemoveElement(element); }
/// <summary> /// Sets an element of the document (replacing the existing element at that position). /// </summary> /// <param name="index">The zero based index of the element to replace.</param> /// <param name="element">The new element.</param> /// <returns> /// The document. /// </returns> public override BsonDocument SetElement(int index, BsonElement element) { EnsureIsMaterialized(); return(base.SetElement(index, element)); }
// public methods /// <summary> /// Adds an element to the document. /// </summary> /// <param name="element">The element to add.</param> /// <returns> /// The document (so method calls can be chained). /// </returns> public override BsonDocument Add(BsonElement element) { EnsureIsMaterialized(); return(base.Add(element)); }
/// <summary> /// Inserts a new element at a specified position. /// </summary> /// <param name="index">The position of the new element.</param> /// <param name="element">The element.</param> public override void InsertAt(int index, BsonElement element) { EnsureIsMaterialized(); base.InsertAt(index, element); }
/// <summary> /// Sets an element of the document (replacing the existing element at that position). /// </summary> /// <param name="index">The zero based index of the element to replace.</param> /// <param name="element">The new element.</param> /// <returns> /// The document. /// </returns> public override BsonDocument SetElement(int index, BsonElement element) { throw new NotSupportedException("RawBsonDocument instances are immutable."); }
/// <summary> /// Removes an element from this document. /// </summary> /// <param name="element">The element to remove.</param> public override void RemoveElement(BsonElement element) { throw new NotSupportedException("RawBsonDocument instances are immutable."); }
/// <summary> /// Tries to get an element of this document. /// </summary> /// <param name="name">The name of the element.</param> /// <param name="value">The element.</param> /// <returns> /// True if an element with that name was found. /// </returns> public override bool TryGetElement(string name, out BsonElement value) { EnsureIsMaterialized(); return(base.TryGetElement(name, out value)); }
/// <summary> /// Initializes a new instance of the BsonDocument class and adds one element. /// </summary> /// <param name="element">An element to add to the document.</param> public BsonDocument(BsonElement element) : base(BsonType.Document) { Add(element); }
/// <summary> /// Initializes a new instance of the BsonDocument class and adds one element. /// </summary> /// <param name="element">An element to add to the document.</param> public BsonDocument(BsonElement element) { Add(element); }