MongoDB.Driver.Document.Add C# (CSharp) Method

Add() public method

public Add ( String key, Object value ) : void
key String
value Object
return void
        public void Add(String key, Object value)
        {
            Dictionary.Add(key, value);
            //Relies on ArgumentException from above if key already exists.
            orderedKeys.Add(key);
        }

Usage Example

Esempio n. 1
0
        public void TestFromDocument()
        {
            Document doc = new Document();
            doc.Add("string", "test");
            doc.Add("int", 1);
            BsonDocument bdoc = BsonConvert.From(doc);
            Assert.AreEqual(2,bdoc.Count);

            /*doc.Add("date", DateTime.MinValue);
            Assert.Throws<ArgumentOutOfRangeException>(
                delegate {BsonConvert.From(doc);});*/ //Not in nUnit 2.4.
        }
All Usage Examples Of MongoDB.Driver.Document::Add