Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

public static class Extensions{
public static void Dump<T>(this T o) { }
public static void Dump<T>(this T o, string s) { }}

These lines allow me to copy code from LINQPad to VS and run it without commenting out every line with .Dump() but it's not enough... http://code.google.com/p/linqpadvisualizer/ - not very comfortable :(

The best result I get searching for LINQPad in VS is this site with code below by Pat Kujawa.

using System.Diagnostics;
using System.IO;
public static class Extensions
{
public static void Dump<T>(this T o)
{
    string localUrl = Path.GetTempFileName() + ".html";
    using (var writer = LINQPad.Util.CreateXhtmlWriter(true))
    {
        writer.Write(o);
        File.WriteAllText(localUrl, writer.ToString());
    }
    Process.Start(localUrl);
}
}

but Error 1 The name 'LINQPad' does not exist in the current context

I couldn't find any LINQPad.dll on the net

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
345 views
Welcome To Ask or Share your Answers For Others

1 Answer

It's not a dll for LINQPad - you need to reference the LINQPad.exe itself.

Right-click your project in Visual Studio -> Add Reference -> Browse to the exe binary file location, typically found in its install directory C:Program FilesLINQPad --> select LINQPad.exe.

Once done, then you can add a "using directive" for it in your file:

using System.Diagnostics;
using System.IO;
using LINQPad;

The method LINQPad.Util.CreateXhtmlWriter will now be available for you to use.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...