title: How to get a list of variables in a class in C#
body: <p>How do I get a list of all the variables in a class, to be used in another class to indicate which Variables will and can be changed by it for example. This is mainly for not having to rewrite a enum when some variables are changed or added.</p>
  
  <p>Edit:
  I want to create a class that has some stats that can be modified (Main), and another type of class (ModifyingObject) that has a list of all the stats that it can change and by how much. I want to easily get the variables of the main class, and add a list of which variables does the modifying class change. if I have let's say 10 variables for different stats how can I easily list all the stats the ModifyingObject class can change in the Main class. </p>
  
  <pre><code>public class Main{
  
     float SomeStat = 0;
     string SomeName = "name";
  
     List&lt;ModifyingObject&gt; objects;
  
     bool CanModifyStatInThisClas(ModifyingObject object){
        //check if the custom object can modify stats in this class
     }
  
  }
  
  public class ModifyingObject{
    ....
  }
  </code></pre>