Here is my generic method code:
public static IT Activate<IT>(string path)
{
//some code here....
}
I'd want to set that generic IT must be only an interface.
Is this possible?
No, there's no such constraint in C#, or in .NET generics in general. You'd have to check at execution time.
if (!typeof(IT).IsInterface)
{
// Presumably throw an exception
}