Simon Mourier's Avatar
Simon Mourier's blog (1352 answers on StackOverflow) about Microsoft technologies C#, C/C++, .NET, WinRT, WinUI, COM, Interop, DirectX, Direct2D, Windows, ...
  • 🔎︎ Search
  • Categories
  • Archives
  • About Me
  • c#
  • visual-studio

Switch enum auto-fill

Dec 7, 2016 See the question and my original answer on StackOverflow

I've written a free and open source extension, based on Roslyn, for Visual Studio 2015 and 2017, that not only allows to fill the switch case for an enum, but is also capable of adding new cases if enum values (fields) have been added to the enum type definition, or sort the list of cases by value or name.

It's available here: Enum Case Generator

This is how to use it:

enter image description here

  • SmoBlog © 2010-2025 Simon Mourier. All rights reserved.
  • Privacy & Terms