title: C# How do I use a variable in multiple classes?
body: <p>I have decided to attempt to make a text based game, at this point in time I am attempting to find a way to keep the characters stats on screen after using Console.Clear.</p>
  
  <p>The way I have attempted to do it is by creating a function:</p>
  
  <pre><code>    static void Stats()
  </code></pre>
  
  <p>The problem I am running into is that I have to use a variable that is located in the main section of the code:</p>
  
  <pre><code>     static void Main(string[] args)
  </code></pre>
  
  <p>I can't however work out how to do this, one way I have found when looking it up is to create a string outside of the functions:</p>
  
  <pre><code>     public static string Player_Gender;
  </code></pre>
  
  <p>As far as I can tell though this is frowned upon. If I am wrong in believing this please let me know and I can continue to do it this way, however if this is correct please can you give me an alternative to this?</p>
  
  <p>I haven't completed the function yet as I want to solve this problem before changing my code quite a bit but this is what it will roughly look like with the addition of other stats etc.</p>
  
  <pre><code>    static void Stats()
      {
          Console.Clear();
          Console.WriteLine("| |================================| |");
          Console.WriteLine("| | Character description + stats: | |");
          Console.WriteLine("| | Gender: {0}                    | |", Player_Gender);
      }
  </code></pre>
  
  <p>The variables currently however are stored here:</p>
  
  <pre><code>    static void Main(string[] args)
      {
          //Ints:
          int correct = 0;
          int Player_One_Handed = 0;
          int Player_Two_Handed = 0;
          int Player_Ranged_Weapon = 0;
          int Player_Magic = 0;
          int Arraycount = 0;
          int Player_Attack_Type = 0;
          int Player_One_Weapon_Damage = 2;
          int Player_Two_Weapon_Damage = 2;
          int Player_Ranged_Weapon_Damage = 2;
          int Player_Magic_Damage = 2;
          int Player_Health_Points = 20;
          int Player_Mana_Points = 12;
          int Enemy_Health_Points;
          int Enemy_Maximum_Damage;
          int Player_Inventory_Money = 0;
          int Player_Inventory_Experience = 0;
          int Player_Quest_Progress = 0;
          int Player_Quest_Goal;
          int Player_EXP = 0;
          int Player_Checked_For_Item = 0;
          int Player_Quest_Objective_Complete = 0;
  
          //Strings:
          string Player_Gender_Confirm;
          string Player_Race;
          string Player_Race_Confirm;
          string Player_Class;
          string Player_Class_Confirm;
          string[] Inventory = new string[20];
          string Enemy_Name;
          string Player_Quest = " ";
          string Quest_Accepted;
          string Player_Quest_Enemy;
  </code></pre>