2

I have just made a new console project in C# and I'm wondering why Console.WriteLine(""); works without using System in the top.

Since when did the using System become optional?

lukas
  • 23
  • 2

1 Answers1

2

Some standard usings are defined in a global file now for convenience and are part of some of the new project templates:

https://devblogs.microsoft.com/dotnet/welcome-to-csharp-10/

Edit: This article dives a little deeper into the topic: https://learn.microsoft.com/en-us/dotnet/core/tutorials/top-level-templates

Generally, starting with .NET 6.0 implicit usings are enabled in new project templates for commonly used namespaces. It can be disabled in the project file.

Julian
  • 5,290
  • 1
  • 17
  • 40