I have a number of plural item classes which each have a collection of singular item classes, like this:
public class Contracts : Items
{
public List<Contract> _collection = new List<Contract>();
public List<Contract> Collection
{
get
{
return _collection;
}
}
}
public class Customers: Items
{
public List<Customer> _collection = new List<Customer>();
public List<Customer> Collection
{
get
{
return _collection;
}
}
}
public class Employees: Items
{
public List<Employee> _collection = new List<Employee>();
public List<Employee> Collection
{
get
{
return _collection;
}
}
}
I can imagine I could use generics to put this up into the parent class. How could I do this, I imagine it would look something like this:
PSEUDO-CODE:
public class Items
{
public List<T> _collection = new List<T>();
public List<T> Collection
{
get
{
return _collection;
}
}
}