本文整理汇总了C#中ObjectDumper.WriteObject方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectDumper.WriteObject方法的具体用法?C# ObjectDumper.WriteObject怎么用?C# ObjectDumper.WriteObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectDumper
的用法示例。
在下文中一共展示了ObjectDumper.WriteObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Write
public static void Write(object element, int depth, TextWriter log)
{
ObjectDumper dumper = new ObjectDumper(depth);
dumper.writer = log;
dumper.WriteObject(null, element);
log.WriteLine(new string('-', 20));
}
示例2: Write
public static string Write(object o, int depth)
{
var sw = new StringWriter();
sw.NewLine = "\r\n";
ObjectDumper dumper = new ObjectDumper(sw, depth);
dumper.WriteObject(null, o);
return sw.ToString();
}
示例3: ToString
public static string ToString(object o, int depth = 0)
{
using (var sw = new StringWriter())
{
ObjectDumper dumper = new ObjectDumper(depth, sw);
dumper.WriteObject(null, o);
return sw.ToString();
}
}
示例4: Write
public static void Write(object element, int depth, NLog.Logger log)
{
if (log.IsTraceEnabled)
{
ObjectDumper dumper = new ObjectDumper(depth);
dumper.WriteObject(null, element);
log.Trace(dumper.builder);
}
}
示例5: String
/// <summary>
/// Dumps the object to a string. Added for convenience by Pete.
/// </summary>
public static string String(object element)
{
using (var w = new StringWriter())
{
var dumper = new ObjectDumper(0) { writer = w };
dumper.WriteObject(null, element);
return w.ToString();
}
}
示例6: Dump
/// <summary>
/// Dumps values of the specified target.
/// </summary>
/// <param name="target">The target.</param>
/// <param name="depth">The depth of the dump.</param>
/// <returns>A string representing the object dump.</returns>
public static string Dump(object target, int depth)
{
try
{
using (var dumper = new ObjectDumper(depth))
{
dumper.WriteObject(null, target);
return dumper.ToString().TrimEnd(Environment.NewLine.ToCharArray());
}
}
catch (Exception ex)
{
return string.Format("Dump failure: {0}{1}{2}", ex.Message, Environment.NewLine, ex.StackTrace);
}
}
示例7: Write
public static void Write(object o, int depth = 0)
{
ObjectDumper dumper = new ObjectDumper(depth, Console.Out);
dumper.WriteObject(null, o);
}
示例8: Write
/// <summary>
/// Writes the specified element.
/// </summary>
/// <param name="prefix">The prefix to print.</param>
/// <param name="element">The element to dump.</param>
/// <param name="depth">The iteration level.</param>
/// <param name="maxcount">The maximum count of dumps.</param>
/// <param name="log">The output logger.</param>
public static void Write(string prefix, object element, int depth, int maxcount, TextWriter log)
{
ObjectDumper dumper = new ObjectDumper(depth, maxcount);
dumper.writer = log;
// string prefix = null;
if (element != null)
{
dumper.Write("[" + element.GetType().Name + "]" + log.NewLine);
//prefix = "[" + element.GetType().Name + "]";
}
dumper.WriteObject(prefix, element);
}
示例9: Write
public static void Write(object o, int depth)
{
ObjectDumper dumper = new ObjectDumper(depth);
dumper.WriteObject(null, o);
}
示例10: Write
public static void Write(object o, int depth, TextWriter outputStream = null)
{
ObjectDumper dumper = new ObjectDumper(depth, outputStream);
dumper.WriteObject(null, o);
}
示例11: Write
internal static void Write(object o, int depth, TextWriter log)
{
ObjectDumper dumper = new ObjectDumper(depth);
dumper.writer = log;
dumper.WriteObject(null, o);
}
示例12: Dump
public static string Dump(object element, int depth)
{
ObjectDumper dumper = new ObjectDumper(depth);
dumper.WriteObject(null, element);
return dumper.builder.ToString();
}
示例13: Write
public static void Write(object o, int depth)
{
Type t = typeof(string);
ObjectDumper dumper = new ObjectDumper(depth);
dumper.WriteObject(null, o);
}
示例14: Write
public static string Write(object o, int depth)
{
var dumper = new ObjectDumper(depth);
dumper.WriteObject(null, o);
return dumper._writer.ToString();
}
示例15: WriteTo
public static void WriteTo(object o, Stream stream, int depth = 0)
{
ObjectDumper dumper = new ObjectDumper(depth, new StreamWriter(stream));
dumper.WriteObject(null, o);
}