Base Class B
|
|
----
| |
| |
D1 D2
public static object GetDerivedClass(Type t1, MyProcess p1)
{
DerivedClass D1 = null;
DerivedClass D2 = null;
if (t1 is typeof(Derived)
{
Process(D1,p1);
return D1;
}
else if(t1 is typeof(Derived)
{
Process(D2,p1);
return D2;
}
}
My Question is what will be the generic way to return the type of object which is passed as t1 Type,
because in real implementation I have deep hierarchy of my design pattern with lots of D1,D2,etc...