I'd like to code a function like the following
public void Foo(System.Type t where t : MyClass)
{ ... }
In other words, the argument type is System.Type
, and I want to restrict the allowed Type
s to those that derive from MyClass
.
Is there any way to specify this syntactically, or does t
have to be checked at runtime?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…