Skip to content

Code Generation Snippets

Jeff Ward edited this page Nov 26, 2022 · 1 revision

This page is a collection of snippets commonly used in code generation. This is a 'Work in Progress'. Eventually this page will be extracted and moved to a more organized location. The 'default insert text' is intentional and meant to serve as a formatting guideline for adding new snippets.

Snippets

Generators

Property Generator

Property with 'Arrow auto-setter' setter

Example
PropertyGenerator.Create(new ArrowExpressionProperty(
            "MyProperty",
            typeof(int),
            Statement.Expression.Invoke("Set", generics: new[] { CustomType.Create("Student") }).AsExpression(),
            new List<Modifiers> { Modifiers.Public, Modifiers.Virtual })

Will generate:

public virtual int MyProperty => Set<Student>();

Clone this wiki locally