WriteUndefined() публичный Метод

Writes a BSON undefined to the writer.
public WriteUndefined ( ) : void
Результат void
Пример #1
0
 public void TestOneUndefined()
 {
     var document = new BsonDocument();
     using (var writer = new BsonDocumentWriter(document))
     {
         writer.WriteStartDocument();
         writer.WriteUndefined("a");
         writer.WriteEndDocument();
     }
     var json = document.ToJson();
     var expected = "{ 'a' : undefined }".Replace("'", "\""); ;
     Assert.Equal(expected, json);
 }
 public void TestTwoNestedUndefineds()
 {
     var document = new BsonDocument();
     using (var writer = new BsonDocumentWriter(document))
     {
         writer.WriteStartDocument();
         writer.WriteStartDocument("nested");
         writer.WriteUndefined("a");
         writer.WriteUndefined("b");
         writer.WriteEndDocument();
         writer.WriteEndDocument();
     }
     var json = document.ToJson();
     var expected = "{ 'nested' : { 'a' : undefined, 'b' : undefined } }".Replace("'", "\"");
     Assert.AreEqual(expected, json);
 }