C# generic - returning objects of the derived class?
- by learningcsharp
public class BaseClass{
public static T Find<T>(object value){
-- db.get<T>("params", value);
}
}
public class Derived: BaseClass{
}
...
void someMethod(){
Derived obj = Derived.Find<Derived>(1);
}
In the above code how do I change Derived obj = Derived.FindDerived<Derived>(1); to Derived obj = Derived.Find(1);