title: C# arraylist user input
body: <p>I have a problem with ArrayList in C#, I know how can I add my own input and run the program so the Array is filled with information. But I would like to fill an ArrayList based on user input.</p>
  
  <p>This is what I need: the user could enter his/hers name, birthdate and age. And all these theree information would be stored in one element. </p>
  
  <p>My goal is to be able to make an application which would allow the user to enter this kind of data for several people and then print the output.</p>
  
  <p>Here is my code:</p>
  
  <p>I have a class Person which handles the user information:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace ArrayList_Siomple_Sorted_10
  {
      class Person
      {
      private string personName;
      private DateTime birthDate;
      private double personAge;
  
      public Person(string name, DateTime bDate, double age)
      {
          personName = name;
          birthDate = bDate;
          personAge = age;
      }
      public string Name
      {
          get { return personName; }
          set { personName = value; }
      }
      public DateTime Birthdate
      {
          get { return birthDate; }
          set { birthDate = value; }
      }
  
      public double Grade
      {
          get { return personAge; }
          set { personAge = value; }
      }
  
      public void Show()
      {
          Console.WriteLine(personName + " " + birthDate.ToString("d.M.yyyy") + " " + personAge);
      }
  }
  }
  </code></pre>
  
  <p>And this is the Main class with main method:</p>
  
  <pre><code>using System;
  using System.Collections;
  using System.Text;
  
  namespace ArrayList_Siomple_Sorted_10
  {
  class Program
  {
      static void Main(string[] args)
      {
          DateTime birthDateP3 = new DateTime(1980, 2, 25);
          Person p3 = new Person("Ann Person", birthDateP3, 8);
          DateTime birthDateP2 = new DateTime(1980, 2, 25);
          Person p2 = new Person("Ann Person", birthDateP2, 8);
          DateTime birthDateP1 = new DateTime(1980, 2, 25);
          Person p1 = new Person("Ann Person", birthDateP1, 8);
  
          ArrayList ar = new ArrayList();
  
          ar.Add(p1);
          ar.Add(p2);
          ar.Add(p3);
          Console.WriteLine("Print the original Array");
          foreach (Person pr in ar)
              pr.Show();
  
      }
  }
  }
  </code></pre>
  
  <p>Is the thing I am trying to achieve even possible? Thank you for your answers.
  V.</p>