DLL中的LinqPad转储 [英] LinqPad Dump from DLL
本文介绍了DLL中的LinqPad转储的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望能够从我的DLL中调用转储,并且下面的代码返回原始HTML结果.我该如何渲染,或者正确的方法是什么?
I would like to be able to call Dump from my DLL and code below returns raw HTML result. How can I render it, or what is the correct approach?
方法
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>
推荐答案
感谢Joe Albahari,添加LinqPad.exe作为引用允许我们使用库中的Dump函数,因此不需要实现.
Thanks to Joe Albahari, adding LinqPad.exe as reference allows us to use Dump function from the library so no implementation is needed.
这篇关于DLL中的LinqPad转储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文