public static void BindParameter(this TextEditorControl txt, TaskData data) { txt.SuspendLayout(); txt.Clear(); txt.SetHighlighting("JSON"); var sb = new StringBuilder(); using (var writer = new StringWriter(sb)) { var w = new JsonWriter(writer) { Pretty = true, Indent = 2 }; w.Serialize(data.Parameters ?? BsonValue.Null); } txt.Text = sb.ToString(); txt.ResumeLayout(); }