diff options
Diffstat (limited to 'linker/Linker/TypeDefinitionExtensions.cs')
-rw-r--r-- | linker/Linker/TypeDefinitionExtensions.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/linker/Linker/TypeDefinitionExtensions.cs b/linker/Linker/TypeDefinitionExtensions.cs new file mode 100644 index 000000000..f94e340c3 --- /dev/null +++ b/linker/Linker/TypeDefinitionExtensions.cs @@ -0,0 +1,21 @@ +using Mono.Cecil; + +namespace Mono.Linker { + public static class TypeDefinitionExtensions { + public static bool HasInterface (this TypeDefinition type, TypeDefinition interfaceType, out InterfaceImplementation implementation) + { + implementation = null; + if (!type.HasInterfaces) + return false; + + foreach (var iface in type.Interfaces) { + if (iface.InterfaceType.Resolve () == interfaceType) { + implementation = iface; + return true; + } + } + + return false; + } + } +}
\ No newline at end of file |