title: is it possible to access properties by name, which is a variable?
body: <p>Sorry if this is asked and answered, I searched but think I don't know the vocabulary to find the answer.  Researched reflection but that doesn't seem to be the answer here?  I'm a novice obviously.  I'm trying/making minor contributions to a mod for the new Battletech game.</p>
  
  <p>I've got this <code>Dictionary</code> and would like to use its keys to set properties as in the <code>foreach</code> below.  I don't know if this is at compile or runtime, my guess is compile time...</p>
  
  <p>I put *limb* in as pseudo-code for how I'm imagining it might work.  The property <code>mechDef.Head</code> is an object of type <code>LocationLoadoutDef</code> with its property <code>CurrentInternalStructure</code> being <code>float</code>.</p>
  
  <p>Hope that makes sense!</p>
  
  <p>Much obliged for any assistance.</p>
  
  <pre><code>public class Settings {
      public readonly Dictionary&lt;string, bool&gt; LimbRepair = new Dictionary&lt;string, bool&gt; {
          { "Head", false },
          { "LeftArm", false },
          { "RightArm", false },
          { "CenterTorso", false },
          { "LeftTorso", false },
          { "RightTorso", false },
          { "LeftLeg", false },
          { "RightLeg", false },
      };
  }
  
  MechDef mechDef = new MechDef
         (__instance.DataManager.MechDefs.Get(id), __instance.GenerateSimGameUID());
  
  foreach (string limb in settings.LimbRepair.Keys) {
      if (!settings.LimbRepair[limb]) {                          
          mechDef.*limb*.CurrentInternalStructure = Math.Max
                      (1f, mechDef.*limb*.CurrentInternalStructure * (float)rng.NextDouble());
  }
  </code></pre>