如何在 C# 中区分 class 和使用类型 API 的委托
How to distinguish class and delegate using Type API in C#
Type.IsClass
property tells whether the type is a class or a delegate. How to distinguish between these to (class and delegate) using Type
class API?
您可以检查是否输入 is a subclass of System.Delegate
:
typeof(Foo).IsSubclassOf(typeof(System.Delegate)));
Type.IsClass
property tells whether the type is a class or a delegate. How to distinguish between these to (class and delegate) using Type
class API?
您可以检查是否输入 is a subclass of System.Delegate
:
typeof(Foo).IsSubclassOf(typeof(System.Delegate)));