title: Two classes in one .cs file
body: <p>im new to this, maybe im doing something wrong. I have on .cs file name PayrollDetails.cs . In it i created two classes (1) get GrossPay and (2) PayrollDetails. I have some getters and setters methods there in the GrossPay class and i would like to use them. Why is it i am not getting it. </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Diagnostics;
  
  namespace SSPModel
  {
  public class getGrossPay {
         public List&lt;BasicPay&gt; BPList;
         private List&lt;Allowance&gt; AlGradeList;
         private List&lt;Allowance&gt; AlPostList;
         private List&lt;AdditionalEarnings&gt; AdEarnList;
         private List&lt;Benefits&gt; BenList;
  
         public void setBPList(List&lt;BasicPay&gt; a)
         {
             BPList = a;
  
         }
         public List&lt;BasicPay&gt; GetBPList() {
  
             return BPList;
         }
  
         public List&lt;Allowance&gt; GetAlGradeList()
         {
             return AlGradeList;
         }
  
         public void setAlGradeList(List&lt;Allowance&gt; a)
         {
             AlGradeList = a;
         }
  
         public List&lt;Allowance&gt; GetAlPostList()
         {
             return AlPostList;
         }
  
         public void setAlPostList(List&lt;Allowance&gt; a)
         {
             AlPostList = a;
         }
         public List&lt;AdditionalEarnings&gt; GetAdEarnList()
         {
             return AdEarnList;
         }
  
         public void setAdEarnList(List&lt;AdditionalEarnings&gt; a)
         {
             AdEarnList = a;
         }
  
  
         public List&lt;Benefits&gt; GetBenList()
         {
             return BenList;
         }
  
         public void setBenList(List&lt;Benefits&gt; a)
         {
             BenList = a;
         }
         public void ssss(getGrossPay inst)
         {
          List&lt;BasicPay&gt; a =   inst.GetBPList();
          for (int i = 0; i &lt; a.Count(); i++)
          {
              Debug.WriteLine(a.ElementAtOrDefault(i));
  
          }
  
         }
         }
        }
  
      public class PayrollDetails
      {
  
          public static void doSomething()
          {
               // i am not getting to call any method from the class getGrossPay.
      }
  }
  </code></pre>
  
  <p>Also, on somewhat an unrelated question, i need some advice on best practice. I have other .cs files (e.g BasicPay.cs, Allowance.cs) where i compute values. I then would call the setter method in the GrossPay class (this works perfectly fine) but i would like to use the get method in another location (or .cs file). I basically wanna set it one place and then use getter in a different location. If i created a new instance of it to use the getter method in another .cs or location, it would result in null. Any ideas of how to go about this? I basically have a long list of functions i want to do, when one i completed, i use the setter and so forth and when ALL is complete call the getter method for ALL that has been set and then do my calculation. Any help would be much appreciated. A more experience programmer may have a better way of going about doing this.</p>