コード例 #1
0
 public ObjectPrinter(object obj, IObjectPrinterConfig config)
 {
     _rootObject = obj;
     _config = config;
     _tab = config.Tab;
     _newline = config.NewLine;
 }
コード例 #2
0
 public ObjectPrinter(object obj, IObjectPrinterConfig config)
 {
     _rootObject = obj;
     _config     = config;
     _tab        = config.Tab;
     _newline    = config.NewLine;
 }
コード例 #3
0
 ///<summary>Uses the ObjectPrinter to loop through the properties of the object, dumping them to the provided TextWriter.</summary>
 public static void DumpTo(this object obj, TextWriter output, IObjectPrinterConfig config = null)
 {
     new Printers.ObjectPrinter(obj, config ?? Printers.ObjectPrinter.GetDefaultContext()).PrintTo(output);
 }
コード例 #4
0
 ///<summary>
 /// Creates a delegate that will use the ObjectPrinter ont the obj when ToString() is called on the delegate.
 /// Useful for delaying execution of the ObjectPrinter until absolutely needed. i.e. logging
 /// </summary>
 public static LazyString Dump(this object obj, IObjectPrinterConfig config = null)
 {
     return(new LazyString(() => new Printers.ObjectPrinter(obj, config ?? Printers.ObjectPrinter.GetDefaultContext()).PrintToString()));
 }
コード例 #5
0
 ///<summary>Uses the ObjectPrinter to loop through the properties of the object, dumping them to a string.</summary>
 public static string DumpToString(this object obj, IObjectPrinterConfig config = null)
 {
     return(obj.Dump(config).ToString());
 }