Is it possible to add cs file references in LinqPad?
Asked Answered
Y

1

7

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)

Yevette answered 15/1, 2022 at 14:34 Comment(0)
F
11

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"
Fizz answered 16/1, 2022 at 2:14 Comment(1)
Fantastic addition. It will help so much integrating LINQPad in larger development efforts. Any aspect of your code can be put on the testpad, executed against the plethora of data options available and explored.Constellation

© 2022 - 2024 — McMap. All rights reserved.