Search code examples
c#visual-studio-codecode-snippets

Is there a way to generate all public members object initializer in vs code?


I'm looking for behaviour similiar to JB Rider. When contructing object through initializer there's an option to generate all public property assignments. Is there a way to add this feature to vs code?


Solution

  • The Roslynator.Refactorings NuGet package has an "Add All Properties to Initializer" action. It's not as polished as the R#/Rider one, but does the job pretty well.

    On top of Refactorings, the whole Roslynator project also has hundreds of Analyzers and CodeFixes that I found useful after ditching R#.