Tired of extra indentation from namespace blocks? Use file-scoped namespaces.
Old Way:
namespace MyApp.Services
{
public class ProductService
{
public void DoSomething()
{
// Code here
}
}
}
// Everything indented one level
New Way (.NET 6+):
namespace MyApp.Services;
public class ProductService
{
public void DoSomething()
{
// Code here - one less indent level!
}
}
Semicolon instead of braces. Entire file is in that namespace. Cleaner code!
