C# 10 New Features I
Most exciting change in c# 10 is the File Level Namespace IMO.
Now, we can remove the curly braces {}
from the namespace of the file. The C# compiler will automatically assume that all the classes in the file belongs to the namespace declared at the top.
So, the below code:
namespace MyNamespace
{
public class MyClass
{
}
}
becomes:
namespace MyNamespace
public class MyClass
{
}
Personally, in my career as a developer I have never declared two namespaces in a single file.
So, this change brings joy to me. :)