I am programming C# in Visual Studio Code with .NET 6. In .NET 6, an explicit main method is no longer necessary. Does anyone know how and where to include using directives like using System.Diagnostics
?
This is what my program currently looks like:
await MeakeBreakfastAsync();
async Task MakeBreakfastAsync(){
...
}
static async Task<string> MakeCoffeAsync() {
...
}
static async Task<string> MakeToastAsync() {
...
}
CodePudding user response:
You still can place the usings on top like
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
Console.WriteLine("Hello World");
await Task.Delay(1000);
List<int> _ = new();
See Microsofts documentation for more details, especially on how to use <ImplicitUsings>disable</ImplicitUsings>
.