C# Generics Multiple Inheritance Problem
- by Ciemnl
Can any one help me with this syntax issue with C#? I have no idea how to do it.
class SomeClass<T> : SomeOtherClass<T> where T : ISomeInterface , IAnotherInterface
{
...
}
I want SomeClass to inherit from SomeOtherClass and IAnotherInterface and for T to inherit ISomeInterface only
It seems the problem is that the where keyword screws everything up so that the compiler thinks both ISomeInterface and IAnotherInterface should both be inherited by T.
This problem is very annoying and I think the solution is some kind of parenthesis but I have tried and failed finding one that works. Also, switching around the order of the two items inherited from SomeClass does not work because the class inherited always has to come before any interfaces. I couldn't find any solutions on the MSDN C# generics pages and I can't beleive I'm the first person to have this problem.
Thanks, any help is much appreciated!