/// <summary> /// Gets generic interface this type implements. /// The generic argument of the interface does not have to be specified. /// If you know the generic argument, use DebugType.GetInterface. /// </summary> /// <param name="fullNamePrefix">Eg. "System.Collections.Generic.IList"</param> public static DebugType GetGenericInterface(this DebugType type, string fullNamePrefix) { foreach (DebugType inter in type.GetInterfaces()) { if (inter.FullName.StartsWith(fullNamePrefix) && inter.GetGenericArguments().Length > 0) { return(inter); } } // not found, search BaseType return(type.BaseType == null ? null : (DebugType)type.BaseType.GetInterface(fullNamePrefix)); }