title: Using a Class 'Age' method in Windows Form c#
body: <p>I'm having trouble understanding how I calculate Age in my Class.</p>
  
  <p>I understand the method on how it is calculated however I don't understand how I'm supposed to use it within my program. </p>
  
  <p>I have an abstract Class called Person and there are properties for Person, Name, DOB etc...Then I have 2 classes, Dentist and Patient who inherit from Person. My program then needs to calculate the age from the DOB which I have created this method(Which was researched). Its the use of this method I'm finding difficult.</p>
  
  <p>This is my Method:</p>
  
  <pre><code>public int AgeInYears(DateTime bday)
  {
          DateTime now = DateTime.Today;
          int age = now.Year - bday.Year;
          if (bday.AddYears(age) &gt; now)
              age--;
          return age;
  }
  </code></pre>
  
  <p>I also have a Surgery Class in which I have an arraylist for Dentist and Patient(I know Arraylists are bad - it was an instruction in the assignment from my lecturer). Then on my form I use these arraylists to populate Text boxes when either a dentist or patient is selected.</p>
  
  <p>I will need to populate the txtAge box with the calculation from my method and the DOB in my Arraylist.</p>
  
  <p>Could someone either point me in the right direction on how I do this please</p>