Suppose I have a class like so:
public class MyClass<T> where T : BaseClass, new()
{
public Boolean DoWork()
{
// do the work, obviously.
}
}
And in some method I need to DoWork() on some MyClass<T> for which I don't need to know T. As far as I know, I need to refer to my MyClass<T> parameter and reiterate the constraints for T, like so:
public void DoLotsOfWork(MyClass<T> item) where T : BaseClass, new()
{
// do some work
// no need to know what T is here:
item.DoWork();
// maybe do some other work.
}
Can method DoLotsOfWork() refer to MyClass<T> without reiterating the constraints on T? (Or possibly even knowing about T?)