title: C# Access Struct using String
body: <p>I am a bit stuck with my game. I have a class called Upgradebuttons. From this class I want to access some variables stored in a struct from another class. I can easily access the variables by typing classname.structname.preferedvar but the structname depends on which upgrade as been clicked. So I want to call the struct using a string. I have tried:</p>
  
  <pre><code>       MethodInfo method = typeof(Classname).GetMethod(structname);
  </code></pre>
  
  <p>But this only works if it is a void and not a struct. What do I need to do in order to get this working? </p>
  
  <pre><code>    public class UpgradeButtons : MonoBehaviour {
  
         public void somefunction{
            // here i want to have access
  
        }
  
   }
  </code></pre>
  
  <p>This is an example of the class I want to have access to:</p>
  
  <pre><code>    public class Upgrades: MonoBehaviour {
          public struct Upgrade1{
              public const int Cost = 10;
              public const float Value = 0.1f;
              public static string Naam = "Autoclicker";
         }
   }
  </code></pre>