How to store a list of Cases from Switch Statement?
问题 In my program I have a listbox that when the user double clicks an object it looks to a switch statement to see what event should occur. As the list begins getting larger I'm curious if there is a way to avoid having to maintain the list of objects in 2 places (once in a list to Add to the listbox, and once in the switch statement. Is there a way to index/read/store the various Cases of my switch statement, then add them as objects to my listbox? Example: (doesn't work, just a theory) Switch