来自DLL的LinqPad Dump

时间:2013-03-31 14:57:07

标签: c# xhtml linqpad

我希望能够从我的DLL调用Dump,下面的代码返回原始HTML结果。我该如何渲染它,或者正确的方法是什么?

方式

public static string Dump<T>(this T obj)
{
    var writer = LINQPad.Util.CreateXhtmlWriter();
    writer.Write(obj);
    return writer.ToString();
}

拨打

Debug.WriteLine(myObject.Dump());

LINQPad上的结果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
      <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
      <meta name="Generator" content="LINQ to XML, baby!" />
      <style type='text/css'>
        ...
      </style>
  </head>
<body>
<div>
...
</div>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

感谢Joe Albahari,添加LinqPad.exe作为参考允许我们使用库中的转储功能,因此不需要实现。

相关问题