/// <summary> /// Check if the frameworks are compatible. /// </summary> /// <param name="target">Project framework</param> /// <param name="candidate">Other framework to check against the project framework</param> /// <returns>True if framework supports other</returns> public bool IsCompatible(NuGetFramework target, NuGetFramework candidate) { if (target == null) { throw new ArgumentNullException("target"); } if (candidate == null) { throw new ArgumentNullException("candidate"); } // check the cache for a solution var cacheKey = new CompatibilityCacheKey(target, candidate); bool?result = _cache.GetOrAdd(cacheKey, (Func <CompatibilityCacheKey, bool>)((key) => { return(IsCompatibleCore(target, candidate) == true); })); return(result == true); }
/// <summary> /// Check if the frameworks are compatible. /// </summary> /// <param name="target">Project framework</param> /// <param name="candidate">Other framework to check against the project framework</param> /// <returns>True if framework supports other</returns> public bool IsCompatible(NuGetFramework target, NuGetFramework candidate) { if (target == null) { throw new ArgumentNullException(nameof(target)); } if (candidate == null) { throw new ArgumentNullException(nameof(candidate)); } // check the cache for a solution var cacheKey = new CompatibilityCacheKey(target, candidate); if (!_cache.TryGetValue(cacheKey, out bool result)) { result = IsCompatibleCore(target, candidate) == true; _cache.TryAdd(cacheKey, result); } return(result); }