So I am a beginner in software development and practicing C# in my time at home.
I have a project that I am working on and have reached a point where I am not sure how to code the functionality.
Imagine in my solution I have a winform UI with a dropdown. Inside that dropdown the user can make a choice and click a button to run a procedure. Depending on what the user has picked, it should initialize the class/object that is picked.
So the dropdown will have options such as; runOptionOne, runOptionTwo. If runOptionTwo is picked in the dropdown, upon clicking the button it will do: runOptionOne runoptionone = new runOptionOne(); runoptionone.Doaction();
I do not want to have string checks on the dropdown as that will be loads of if statements.
Is there a technique or method to initialize a specific class based on user choice.