I have an object which is containing an IEnumerable where T can be among a couple of Classes I have in my Data Model.
Let's say T can be either Employee or Employer. Now having a bare object, knowing that it is certainly holding an IEnumerable how Can I say which Type it is holding? Employee or Employer? Or better how can I cast or reflect the object to IEnumerable?
If I keep the type when I set the object, will it help me cast or reflect the object to what it was at first?
If I keep these
object source = db.Employees; //IEnumerable<Employee>
type dataType = Employee;
can I cast or reflect back to an IEnumerable of Employees?