我已经开始学习C#/.NET/VisualStudio(2022年)出现了这个奇怪的问题;系统及其嵌套名称空间中的所有方法/类似乎都可以在without个完整路径或开始使用指令时使用.
下面的例子编译得很好:
// Program.cs
namespace MyApp
{
internal class Program
{
static void Main()
{
Console.WriteLine("Hello World!"); //System.Console
}
static HttpClient client = new HttpClient(); //System.Net.Http.HttpClient
}
}
为什么会发生这种情况,我能以某种方式禁用这种行为吗?