Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>C# Genenate ConstructorNew to Visual Studio Code? Get it now.
C# Genenate Constructor

C# Genenate Constructor

vain0x

|
13,886 installs
| (2) | Free
Provide command to generate constructor from fields/properties
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

C# Constructor Generator for VSCode

Example

From:

namespace MySample
{
    class Hoge
    {
        public int Foo { get; }

        private readonly string _bar;

        /* cursor here */
    }
}

To:

namespace MySample
{
    class Hoge
    {
        public int Foo { get; }

        private readonly string _bar;

        public Hoge(int foo, string bar)
        {
            Foo = foo;
            _bar = bar;
        }
    }
}
  • Different from csharpextensions:
    • Support sealed class and struct
    • Not generate assignments for fields/proeprties with initializer
    • Alway generate public constructor
  • Known issues
    • Not support inline types
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft