From 76241db42787273a24a90eac0a3308df2a70b678 Mon Sep 17 00:00:00 2001 From: de4dot Date: Fri, 4 Nov 2011 00:06:25 +0100 Subject: [PATCH] Add isDelegate() method --- blocks/DotNetUtils.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/blocks/DotNetUtils.cs b/blocks/DotNetUtils.cs index 23f79a37..893ebb47 100644 --- a/blocks/DotNetUtils.cs +++ b/blocks/DotNetUtils.cs @@ -278,8 +278,12 @@ namespace de4dot.blocks { } } + public static bool isDelegate(TypeReference type) { + return type != null && (type.FullName == "System.Delegate" || type.FullName == "System.MulticastDelegate"); + } + public static bool isDelegateType(TypeDefinition type) { - return type != null && type.BaseType != null && type.BaseType.FullName == "System.MulticastDelegate"; + return type != null && isDelegate(type.BaseType); } public static bool isSameAssembly(TypeReference type, string assembly) {