How to put an interface constraint on a generic method in C# 3.5?
c#, constraints, generics, interface
Solution
C# and the CLR don't support overall interface constraints, although you can constrain it to a particular interface (see other answers). The closest you can get is 'class' and check the type using reflection at runtime I'm afraid. Why would you want an interface constraint in the first place?
Problem
I want to achieve something like this in C# 3.5: ``` public void Register<T>() : where T : interface {} ``` I can do it with class or struct, but how to do it with an interface?