Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Nifty C# Templates: New Class, Record & NamespaceNew to Visual Studio Code? Get it now.
Nifty C# Templates: New Class, Record & Namespace

Nifty C# Templates: New Class, Record & Namespace

Nifty

|
3 installs
| (0) | Free
New C# class, interface, record, enum, test and controller files with the right namespace, plus namespace syncing.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Nifty C# Templates

New C# class, interface, record, enum, test and controller files with the right namespace, plus namespace syncing.

Maintained. No sign-in. No telemetry. Works in VS Code, Cursor, Windsurf, VSCodium and other editors that use Open VSX.

Features

Right-click the Billing folder, New C# Class, type a name in plain words and get InvoiceNumberGenerator with the folder's namespace

A new class in Services/Billing with the matching namespace

An exception class with the three standard constructors

Namespaces synced after moving files into a new folder

  • Right-click → New C# → Class (or Interface, Record, Enum) in the Explorer, type a name, done.
  • The namespace is always right. It's built from the nearest project's RootNamespace (or the project name) plus the folder path: a file in Shop.Api/Services/Billing gets namespace Shop.Api.Services.Billing;.
  • Modern by default. File-scoped namespaces (namespace X;) for .NET 6+ and C# 10+, block namespaces for older projects.
  • More templates under New C# File…: record struct, struct, static class, abstract class, exception (with the three standard constructors), xUnit test class, NUnit test class and ASP.NET Core API controller.
  • Naming conventions applied. repository becomes IRepository for interfaces, NotFound becomes NotFoundException, Orders becomes OrdersController, and Calculator becomes CalculatorTests.
  • Sync Namespace with Folder. Moved files around? Right-click a file or folder to fix every namespace to match its location.
  • Works without C# Dev Kit, including in Cursor, Windsurf and VSCodium.
  • Works in the browser on vscode.dev and github.dev.

Commands

Command What it does
New C# Class… / Interface… / Record… / Enum… Create that file in the selected folder
New C# File… Pick from all 12 templates
Sync Namespace with Folder Fix the namespace of a file, or every .cs file in a folder

Settings

Setting Default What it does
nifty.csharp-templates.namespaceStyle auto auto, fileScoped or block

Indentation follows your C# editor settings.

Install

  • VS Code: search for "Nifty C# Templates" in the Extensions view, or install from the Visual Studio Marketplace.
  • Cursor, Windsurf, VSCodium, Kiro, Antigravity: install from Open VSX.

Privacy

This extension collects no telemetry, needs no account and makes no network requests.

More Nifty tools

  • Nifty NuGet: NuGet Package Manager: Search, add, update and remove NuGet packages, see outdated and vulnerable ones, in VS Code, Cursor and every editor. (Open VSX)
  • Nifty Paste JSON as Code: JSON to Types: Turn JSON on your clipboard into types for TypeScript, C#, Go, Rust, Python, Java, Kotlin, Swift, Dart and more. (Open VSX)
  • Nifty Mermaid: Mermaid Diagram Preview & Export: Mermaid diagrams with no account: live preview beside .mmd files and Markdown, diagrams in the Markdown preview, syntax highlighting, and export to SVG or PNG. (Open VSX)
  • Nifty Beautify: Format HTML in PHP, Blade & Twig: Format HTML inside PHP, Blade, Twig, Jinja, Handlebars, ERB and Liquid templates without breaking the template tags. (Open VSX)
  • Nifty REST Client: .http Files & HTTP Requests: Send HTTP requests from .http files: variables, environments, request chaining, response viewer, cURL import and export, and history. No account, no cloud. (Open VSX)
  • Nifty SQL: SQL Formatter for 20 Dialects: Format SQL in 20 dialects, including dbt and Jinja templates, with your team's settings. (Open VSX)

See all 21 Nifty tools at https://getnifty.dev

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft