/// <inheritdoc />
        public MethodInfo GetMethodMap(Type targetType, MethodInfo interfaceMethod)
        {
            Debug.Assert(targetType != null, "targetType != null");
            Debug.Assert(interfaceMethod != null, "interfaceMethod != null");

            var key = new MethodMapCacheKey(targetType, interfaceMethod);

            if (_methodMapCacheKey.TryGetValue(key, out var map))
            {
                return(map);
            }

            map = ReflectedMethod.GetMethodMap(targetType, interfaceMethod);

            if (_methodMapCacheKey.TryAdd(key, map))
            {
                return(map);
            }

            return(_methodMapCacheKey.TryGetValue(key, out var cmap) ? cmap : map);
        }
 private bool Equals(MethodMapCacheKey other)
 {
     return(TargetType == other.TargetType &&
            Equals(InterfaceMethod, other.InterfaceMethod));
 }