C# class
A blueprint that creates a C# class together with its interface. File names and type names use PascalCase, the namespace is entered by hand.
Config
Section titled “Config”module.exports = { blueprints: [ { title: "C# class", variables: [ { key: "name", prompt: "Class name" }, { key: "ns", prompt: "Namespace (e.g. MyApp.Services)" }, ], snippets: { contract: `namespace {ns.raw};
public interface I{name.pascal}{ void Run();}`, implementation: `namespace {ns.raw};
public class {name.pascal} : I{name.pascal}{ public void Run() { }}`, }, structure: { files: [ { name: "I{name.pascal}.cs", snippet: "contract" }, { name: "{name.pascal}.cs", snippet: "implementation" }, ], }, }, ],};-
Right-click the folder where the class should live (for example
src/MyApp/Services) and choose Run Blueprintor…. -
Select C# class.
-
Enter
order serviceas the class name, thenMyApp.Servicesas the namespace.
Result
Section titled “Result”DirectoryServices
- IOrderService.cs
- OrderService.cs
namespace MyApp.Services;
public interface IOrderService{ void Run();}namespace MyApp.Services;
public class OrderService : IOrderService{ public void Run() { }}