title: C# store an integer input in class for recall later?
body: <p>I want to store the integer input from a user as an instance level variable so that I can recall it at a later time</p>
  <p>So far in Class.cs I have:</p>
  <pre><code>namespace home
  {
      internal class Class
      {
  
          public string id;
          
  
          public Class()
          {
  
              Console.WriteLine(&quot;please enter ID&quot;);
              string input = Console.ReadLine();
              int id;
              Int32.TryParse(input, out id);
          }
      }
  }
  </code></pre>
  <p>And then in program.cs:</p>
  <pre><code>using home; 
  Class object1 = new Class();
  Console.WriteLine(object1.id);
  </code></pre>
  <p>This allows the user to input the number, however, it does not print the number afterwards.</p>
  <p>I have managed to recall a string input such as a name, I just cannot get it to recall a number input, so everything works fine except for the number being saved and displayed at a later time. If I put <code>Console.WriteLine(id);</code> in the class.cs then it will display it, but obviously it's just displaying the input and not really storing it.</p>