【问题标题】:Where and how to include Using directives in C# and .NET6?在 C# 和 .NET6 中的何处以及如何包含 Using 指令?
【发布时间】:2022-08-08 17:03:05
【问题描述】:

我正在使用 .NET6 在 Visual Studio 代码中编写 C#。在 .NET6 中,不再需要显式的 main 方法。有谁知道如何以及在何处包含使用 System.Diagnostics 等指令?

这就是我的程序目前的样子。

await MeakeBreakfastAsync();

async Task MakeBreakfastAsync(){
    ...
}


static async Task<string> MakeCoffeAsync(){
    ...

}

static async Task<string> MakeToastAsync(){
    ...

}

    标签: c# .net visual-studio-code omnisharp


    【解决方案1】:

    就像在上面一样

    using System;
    using System.Collections.Generic;
    using System.Threading.Tasks;
     
    Console.WriteLine("Hello World");
    await Task.Delay(1000);
    List<int> _ = new ();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-05
      • 1970-01-01
      • 2020-02-01
      • 2013-11-26
      • 1970-01-01
      相关资源
      最近更新 更多