title: C# Combine Class/models or Create Multiple Classes with Inheritance
body: <p>This is a pretty basic question but it's bugging me.  Should I combine similar Model properties together into one Class Model or is it better to split them up and add inheritance where it makes sense?  I tend to like to return only data necessary for each request but I question it when it's a smaller amount of data.  It's better to explain with an example.</p>
  
  <p>I have a web application that does various AJAX calls.  Many of the calls return IEnumerables</p>
  
  <pre><code>public class GroupBaseModel {
      public int GroupId { get; set; }
      public int GroupName { get; set; }
  }
  public class RoleBaseModel
  {
      public int RoleId { get; set; }
      public int RoleName { get; set; }
  }
  public class GroupMemberModel : GroupBaseModel
  {
      public bool IsMember { get; set; }
  }
  public class GroupRoleBaseModel {
      public int GroupId { get; set; }
      public int GroupName { get; set; }
      public int RoleId { get; set; }
      public int RoleName { get; set; }
  }
  </code></pre>
  
  <p>I have calls that return IEnumerables of each of these classes on several different pages.  Some calls just return the GroupRoleModel, while another will return the GroupRoleBaseModel etc.  (each is pulling the minimum required data for each request at this time)  </p>
  
  <p>So my first question, is it possible to concatenate two existing Classes?  For example above, the GroupRoleBaseModel is just the properties of the GroupBaseModel + GroupRoleModel, can I combine them without implementing all the properties again?  </p>
  
  <p>The second question is, since we are talking about very small classes, should I just do like below and use one single class?  Even though some requests will return unneeded data?</p>
  
  <pre><code>public class GroupBaseModel {
      public int GroupId { get; set; }
      public int GroupName { get; set; }
      public int RoleId { get; set; }
      public int RoleName { get; set; }
      public bool IsMember { get; set; }
  }
  </code></pre>
  
  <p>Thanks for your thoughts!</p>