WriteRawBsonDocument() public method

Writes a raw BSON document.
public WriteRawBsonDocument ( IByteBuffer slice ) : void
slice IByteBuffer The byte buffer containing the raw BSON document.
return void
 /// <summary>
 /// Serializes an object to a BsonWriter.
 /// </summary>
 /// <param name="bsonWriter">The BsonWriter.</param>
 /// <param name="nominalType">The nominal type.</param>
 /// <param name="value">The object.</param>
 /// <param name="options">The serialization options.</param>
 public override void Serialize(
     BsonWriter bsonWriter,
     Type nominalType,
     object value,
     IBsonSerializationOptions options)
 {
     if (value == null)
     {
         bsonWriter.WriteNull();
     }
     else
     {
         var rawBsonDocument = (RawBsonDocument)value;
         var slice = rawBsonDocument.Slice;
         using (var clonedSlice = slice.GetSlice(0, slice.Length))
         {
             bsonWriter.WriteRawBsonDocument(clonedSlice);
         }
     }
 }
 /// <summary>
 /// Serializes an object to a BsonWriter.
 /// </summary>
 /// <param name="bsonWriter">The BsonWriter.</param>
 /// <param name="nominalType">The nominal type.</param>
 /// <param name="value">The object.</param>
 /// <param name="options">The serialization options.</param>
 public override void Serialize(
     BsonWriter bsonWriter,
     Type nominalType,
     object value,
     IBsonSerializationOptions options)
 {
     if (value == null)
     {
         bsonWriter.WriteNull();
     }
     else
     {
         var lazyBsonDocument = (LazyBsonDocument)value;
         var slice = lazyBsonDocument.Slice;
         if (slice == null)
         {
             BsonDocumentSerializer.Instance.Serialize(bsonWriter, typeof(BsonDocument), lazyBsonDocument, options);
         }
         else
         {
             using (var clonedSlice = slice.GetSlice(0, slice.Length))
             {
                 bsonWriter.WriteRawBsonDocument(clonedSlice);
             }
         }
     }
 }