2013-03-31 3 views
1

내 DLL에서 덤프를 호출하고 아래 코드가 원시 HTML 결과를 반환 할 수 있기를 바랍니다. 어떻게 렌더링 할 수 있습니까? 아니면 올바른 접근 방식은 무엇입니까?LinqPad DLL에서 덤프

방법

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

전화

<!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> 
+0

가능한 복제본 [LINQPad - 덤프 확장 메서드 - 내가 원한다] (http://stackoverflow.com/questions/2699466/linqpad-dump-extension-method-i-want-one) – DaveShaw

+0

@DaveShaw @DaveShaw를 제거하십시오. 메시지에 "이 질문에 이미 답변이있을 수 있습니다."라는 메시지가 표시됩니다. 이 질문은 결과를 검색하는 것이 아니라 결과의 형식 (표시 문제)과 관련이 있습니다. 감사 – cilerler

답변

1

감사합니다 조 Albahari에 LINQPad에

Debug.WriteLine(myObject.Dump()); 

결과, LinqP 추가 참조로 ad.exe를 사용하면 라이브러리에서 덤프 함수를 사용하여 구현할 필요가 없습니다.