C# generic - returning objects of the derived class?
Posted
by learningcsharp
on Stack Overflow
See other posts from Stack Overflow
or by learningcsharp
Published on 2010-03-20T22:00:48Z
Indexed on
2010/03/20
22:11 UTC
Read the original article
Hit count: 335
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);
© Stack Overflow or respective owner