Search code examples
linqpadlinqpad7

Is it possible to add cs file references in LinqPad?


I know I can add assemblies to LinqPad and I know I can paste in classes in queris, but is it possible to add CSharp class files(cs) and reference these in a query window?

I tried to a few classes but could not access them even if I included the namespace (in f4)


Solution

  • You can include .cs files with the #load directive (LINQPad 6 and later):

    #load "c:\source\MyLib\Utils\LinqExtensions.cs"
    

    Relative paths and wildcards are also supported:

    #load "..\..\source\myutil\*.cs"
    #load "..\..\source\shared\*.cs /s"