Classes defined in LinqPad are nested, inner classes of UserQuery. Is there a way to declare classes that are root classes?
Asked
Active
Viewed 906 times
2 Answers
11
From version 2.4 / 4.4, you can create root classes in LINQPad by defining the NONEST
symbol (in C# Program mode):
#define NONEST
void Main()
{
typeof (Foo).FullName.Dump(); // Foo
}
class Foo
{
}
If you define a static class (which C# does not allow fo be nested), you don't need the NONEST symbol - LINQPad will extract your nested class automatically.

Joe Albahari
- 30,118
- 7
- 80
- 91
-
It appears it also does this when a static class is defined that has extension methods attached one of the other nested types. Is this intentional? – Jeff Mercado May 18 '15 at 06:55
-1
Select 'C# Program' as the language type in the newer versions.

Luke Belbina
- 5,708
- 12
- 52
- 75
-
1The classes defined under this mode are implemented as nested classes, which is the frustration of the OP. – Aren Aug 19 '15 at 22:46