How does LINQPad compile code?

后端 未结 2 1205
遥遥无期
遥遥无期 2020-12-12 22:39

I am guessing it neither invokes csc.exe or implement an entire compiler, so how does it work?

Update: Thanks to Jon Skeet for the pointer to code that was easy to l

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-12 23:08

    From "How LINQPad Works":

    LINQPad compiles your queries using .NET's CSharpCodeProvider (or VBCodeProvider)

    Obviously there's rather more to it, but that's the bit you asked about - read the link for more details.

    If you want to have a look at a rather more simplistic implementation, you could download the source code for Snippy, the little tool I created for C# in Depth. Again, it uses CSharpCodeProvider - and it's a simple enough example that it's easy to understand, with any luck. (There are only a few classes involved, IIRC.)

提交回复
热议问题