Allow users to remove default assembly references added by LinqPad
LinqPad includes references to common .NET assemblies and its namespaces in each query by default, but it doesn't provide a way for users to remove any of these references and/or namespaces, if they don't use or need them.
This causes issues due to name clashing between classes in different namespace.
For example, the sample code below uses Newtonsoft.Json v12.0.2 to format a JSON string:
var jsonStringMinified = @"{""x"":100.5,""y"":200.4}";
var parsedJson = JToken.Parse(jsonStringMinified);
var jsonStringIndented = parsedJson.ToString(Formatting.Indented);
jsonStringIndented.Dump();
The namespaces imported in this example are:
Newtonsoft.Json
Newtonsoft.Json.Linq
We get a compilation error: "CS0104 'Formatting' is an ambiguous reference between 'Newtonsoft.Json.Formatting' and 'System.Xml.Formatting'which is correct given the compiler cannot choose which
Formatting` enum to use
Unfortunately, it's not possible to remove the namespace using to System.Xml
and therefore the only way to make the code above works, is to fully qualify the enum:
// ...
var jsonStringIndented = parsedJson.ToString(Newtonsoft.Json.Formatting.Indented);
This is not a great experience, as I can have code working in a .NET app within Visual Studio, but after copying and pasting in a LinqPad query, it doesn't work because of these name clashes.

You can now remove as well as add namespaces in LINQPad 6.