Namespaces have been a feature of C# since 1.0 and while you can theoretically have more than one declared in a file it is very unusual and so serves only to cause the rest of the file to be unnecessarily indented.
C# 10.0 allows you to specify a namespace without {} in order to apply it to the whole file and remove one level of indentation.
Code
C#
using System;
namespace MyCompany.MyProduct;
public class EmployeeRepository : Repository
{
// ...
}C#
using System;
namespace MyCompany.MyProduct
{
public class EmployeeRepository : Repository
{
// ...
}
}Notes
- The file scoped namespace declaration may occur before or after the using statements.