Dear Developers,
I am looking for a way to access an object from a string value.
I have a class describing the object Card that contains properties related to the Card points :
public class Card
{
public int Health { get; set; }
public int Magic { get; set; }
}
myCard = new Card();
myCard.Health = 5;
myCard.Magic = 3;
Then, based on a card name store in a variable (choice = "myCard"
), I want to access the card properties : choice.Health.
The thing is that the object « choice » doesn’t exist because the targeted object should be « myCard ».
Any idea how I could do that ?
Thank you very much