"using namespace;" statements in C# query file

Is there any reason LINQPad doesn't support

using My.Namespace.Name;

in a C# statement/program file to import a namespace? That seems like the obvious way to do it, familiar to all C# programmers.

I thought it must have been asked before, but searching this forum for "using namespace" didn't return anything relevant.


  • Note that if you paste using statement(s) at the start of a query you get the option to "Move 'using' directives into Query Properties?".
  • You're right - thanks! I was typing it, not pasting it.

    This is kind of a "hidden" feature and it would be more obvious if the "using"s simply stayed in the main query window, but OK, this works.
  • I will second preferring that everything be in the text of the query instead of hidden in properties.
  • Yes, this should be an option.

    My medium and long-term plan is for LINQPad to offer compatibility with the Roslyn scripting library, which allows for using directives in the script. This will give the best experience, because the using directives will be valid syntax and so LINQPad won't have to fight the compiler.

    The challenge is to figure out how to do this without breaking compatibility with existing scripts.
  • It seems the helper isn't implemented for VB Imports statements like it is for C# using statements - perhaps this would be nice to add for VB programmers.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!