On Fri, 06 Jun 2008 10:04:16 -0700, Bruno Neves Pires Silva
<br**********@gmail.comwrote:
I've got the following problem:I Have a class that uses generics like
above:
class ClassName<typename>
{
public void method(typename var)
{
var.Method2(); //I've got a error here.
}
}
How can I Access Method2 from the class typename ???
You need to include a constraint, or you need to cast the variable.
Note that if the type used as "typename" isn't an interface or a base
class for some other group of classes, then if you find yourself doing
this you may be negating the point of using a generic class. :)
Pete