vendredi 22 juin 2018

Using a string as a name of an attribute of a class in C#

the question probably already has been answered, but i honestly dont know what to search for, an "Reflection" did not solve my issue.

I want to call a field by a string such as:

    string str = "Green";
    Color colorForPurpose = Color.str;

Of course this does not work, but the purpose should be clear.

Anyone has an idea?





Aucun commentaire:

Enregistrer un commentaire