I'm actually trying to solve a problem with List in C#.
Here are my classes:
public class A {
public int ID { get; set; }
public string tag { get; set; }
}
public class B1 : A {
public int info { get; set; }
}
public class B2 : A {
public C info { get; set; }
}
public class C {
...
}
I would like to have a function like that:
public List<A> function(typeEnum t)
To be able to return an object instance of type List<B1>
or List<B2>
and so on, depending on the requested typeEnum
, as a List<A>
.
My problem is the different type of info
in B1
and B2
classes.