WriteJavaScriptWithScope() public abstract method

Writes a BSON JavaScript to the writer (call WriteStartDocument to start writing the scope).
public abstract WriteJavaScriptWithScope ( string code ) : void
code string The JavaScript code.
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 script = (BsonJavaScriptWithScope) value;
         bsonWriter.WriteJavaScriptWithScope(script.Code);
         script.Scope.WriteTo(bsonWriter);
     }
 }
        /// <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)
            {
                throw new ArgumentNullException("value");
            }

            var script = (BsonJavaScriptWithScope)value;
            bsonWriter.WriteJavaScriptWithScope(script.Code);
            BsonDocumentSerializer.Instance.Serialize(bsonWriter, typeof(BsonDocument), script.Scope, null);
        }