I am creating a game in C# Windows form and I will have 9 different characters inside the game for my player to choose from (using radio buttons). I have a variable called PlayerChar and Whenever the player chooses a character I will store the character's name inside that variable. Also I have 9 different classes for each characters. What I am trying to do is, to get the program to create an object from the class of the character chosen. but I don't know how to use variable PlayerChar as my class name.
PlayerChar obj = new PlayerChar();
This is basically what I am trying to do. Also I tried using Activator.CreateInstance:
PlayerChar myObj = Activator.CreateInstance(PlayerChar);