Automatonymous.Tests.InterfaceReflectionCache.GetInterfaceInternal C# (CSharp) Method

GetInterfaceInternal() private method

private GetInterfaceInternal ( Type type, Type interfaceType ) : Type
type System.Type
interfaceType System.Type
return System.Type
        Type GetInterfaceInternal(Type type, Type interfaceType)
        {
            if (interfaceType.GetTypeInfo().IsGenericTypeDefinition)
                return GetGenericInterface(type, interfaceType);

            Type[] interfaces = type.GetTypeInfo().ImplementedInterfaces.ToArray();

            return interfaces.FirstOrDefault(t => t == interfaceType);
        }
    }