Handle Implicit Usings when using #load
If using #load on a .NET 6 C# file that used implicit usings, LINQPad will complain when using anything from the implicit namespaces, such as saying that the type Action<> could not be found when System is implicit. It would be nice if LINQPad could handle implicit usings so if I #load such a file, it should function properly.
-
Create a statements-based query or a .cs file with the following content:
global using System;
global using System.Collections.Generic;
global using System.IO;
global using System.Linq;
global using System.Net.Http;
global using System.Threading;
global using System.Threading.Tasks;Save this to a file called "iusing.linq" or "iusing.cs".
Then in your query, #load that file (along with the other .cs files you wish to import):
#load "iusing"
or
#load "iusing.cs"See https://forum.linqpad.net/discussion/2636/lp7-does-not-handle-implicit-usings for the discussion.