As you all know using java it is possible to create methods which require one or more objects extended from another class; to do this you have to write:
public void method(Class<? extends class_name> Object_name)
I was wondering whether there is a corresponding statement in C#. Does anybody know?
Well, that’s accepting a type rather than an object, but you can do something slightly similar with generic methods in C#:
Then you can use
typeof(T)within the method.If you need to specify an actual object compatible with type
T, you can have that as a normal method parameter of typeT.If you need more, please update your question with more specific requirements.