Mega Code Archive

 
Categories / C# / Reflection
 

Determines whether the current type is an implementation of the specified interface

using System; public static class TypeExtensions {     public static bool IsImplementationOf<T>(this Type type)     {         if (!typeof(T).IsInterface)             throw new NotSupportedException("Only interfaces supported in IsImplementationOf");         return type.GetInterface(typeof(T).FullName) != null;     } }