I am translating a Java API into C# and I have method like this:
public void addSpecificImplementation(String name, Class<? extends SomeInterface> implClass)
I know that Type is the equivalent of java.lang.Class in C#. I don't know how to write this method to take a parameter of 'Type' with the constraint that it must be a sub-type of a specific interface. How is this done in C#?
Here is the actual java implementation:
public void addSpecificImplementation(String name, Class<? extends SomeInterface> implClass) {
Constructor<BeanT> ctor = implClass.getConstructor();
myInstance = ctor.newInstance();
..... add the instance to some data structure.....
}