Newtonsoft.Json.Bson.BsonWriter.WriteStartConstructor C# (CSharp) Method

WriteStartConstructor() public method

Writes the start of a constructor with the given name.
public WriteStartConstructor ( string name ) : void
name string The name of the constructor.
return void
        public override void WriteStartConstructor(string name)
        {
            throw JsonWriterException.Create(this, "Cannot write JSON constructor as BSON.", null);
        }

Usage Example

コード例 #1
0
        public void WriteConstructor()
        {
            ExceptionAssert.Throws<JsonWriterException>(() =>
            {
                MemoryStream ms = new MemoryStream();
                BsonWriter writer = new BsonWriter(ms);

                writer.WriteStartArray();
                writer.WriteStartConstructor("fail");
            }, "Cannot write JSON constructor as BSON. Path ''.");
        }
All Usage Examples Of Newtonsoft.Json.Bson.BsonWriter::WriteStartConstructor