This example is a simplification of the real problem, but how can I get this to compile? I would expect the generics constraints to propagate.
Since T is a TClass and TClass is a class, why isnt T a class?
public class MyClass<TClass> where TClass : class
{
public void FuncA<Ta>() where Ta : class
{
}
public void FuncB<Tb>() where Tb : TClass
{
}
public void Func<T>()
where T : TClass
{
FuncA<T>();
FuncB<T>();
}
}
EDIT:
This actually works. Eric Lippert made me think, thanks.
Since T is a TClass and TClass is a TAnotherType, T is actually TAnotherType.
public class MyClass<TClass, TAnotherType> where TClass : TAnotherType
{
public void FuncA<Ta>() where Ta : TClass
{
}
public void FuncB<Tb>() where Tb : TAnotherType
{
}
public void Func<T>()
where T : TClass
{
FuncA<T>();
FuncB<T>();
}
}
For compiling this do;
because input of FunA is just a class not special class.