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

WriteComment() public method

Writes a comment /*...*/ containing the specified text.
public WriteComment ( string text ) : void
text string Text to place inside the comment.
return void
        public override void WriteComment(string text)
        {
            throw JsonWriterException.Create(this, "Cannot write JSON comment as BSON.", null);
        }

Usage Example

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

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