File Templates & Quick File Creation
Automatic Namespace Detection and Adjustment
Smart namespace management that automatically determines the correct namespace for new files.
How It Works
Section titled “How It Works”When you create a file, the namespace is automatically determined by:
- Project Root Namespace: Read from the .csproj file
- Folder Structure: Relative path from project root
- .NET Conventions: Standard naming patterns
Examples
Section titled “Examples”Project Root
Section titled “Project Root”File: MyProject/MyClass.cs
Namespace: MyProject
In Subfolder
Section titled “In Subfolder”File: MyProject/Services/UserService.cs
Namespace: MyProject.Services
Nested Folders
Section titled “Nested Folders”File: MyProject/Features/Auth/Services/AuthService.cs
Namespace: MyProject.Features.Auth.Services
Namespace Styles
Section titled “Namespace Styles”File-Scoped Namespaces (Modern)
Section titled “File-Scoped Namespaces (Modern)”namespace MyProject.Services;
public class UserService{}Traditional Namespaces
Section titled “Traditional Namespaces”namespace MyProject.Services{ public class UserService { }}The extension detects your project’s style and matches it.
Manual Adjustment
Section titled “Manual Adjustment”If a namespace needs correction:
- Use the “Adjust Namespace” command
- The namespace will be updated based on current location
- All usings and references remain intact
Configuration
Section titled “Configuration”Namespace behavior respects:
- Project settings
- EditorConfig
- C# language version
- Team conventions
No manual configuration needed - it just works!