public TargetFrameworkInformation Clone()
        {
            var clonedObject = new TargetFrameworkInformation();

            clonedObject.FrameworkName       = FrameworkName;
            clonedObject.Dependencies        = Dependencies.Select(item => item.Clone()).ToList();
            clonedObject.Imports             = new List <NuGetFramework>(Imports);
            clonedObject.AssetTargetFallback = AssetTargetFallback;
            clonedObject.Warn = Warn;
            clonedObject.DownloadDependencies.AddRange(DownloadDependencies.Select(item => item.Clone()));
            clonedObject.FrameworkReferences.AddRange(FrameworkReferences);
            return(clonedObject);
        }
Beispiel #2
0
        public TargetFrameworkInformation Clone()
        {
            var clonedObject = new TargetFrameworkInformation();

            clonedObject.FrameworkName       = FrameworkName;
            clonedObject.Dependencies        = Dependencies.Select(item => item.Clone()).ToList();
            clonedObject.Imports             = new List <NuGetFramework>(Imports);
            clonedObject.AssetTargetFallback = AssetTargetFallback;
            clonedObject.Warn = Warn;
            clonedObject.DownloadDependencies.AddRange(DownloadDependencies.Select(item => item.Clone()));
            clonedObject.FrameworkReferences.AddRange(FrameworkReferences);
            clonedObject.RuntimeIdentifierGraphPath = RuntimeIdentifierGraphPath;
            clonedObject.CentralPackageVersions.AddRange(CentralPackageVersions.ToDictionary(item => item.Key, item => item.Value));
            return(clonedObject);
        }
        public bool Equals(TargetFrameworkInformation other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(EqualityUtility.EqualsWithNullCheck(FrameworkName, other.FrameworkName) &&
                   Dependencies.OrderedEquals(other.Dependencies, dependency => dependency.Name, StringComparer.OrdinalIgnoreCase) &&
                   Imports.SequenceEqualWithNullCheck(other.Imports) &&
                   AssetTargetFallback == other.AssetTargetFallback &&
                   DownloadDependencies.OrderedEquals(other.DownloadDependencies, dep => dep) &&
                   FrameworkReferences.OrderedEquals(other.FrameworkReferences, keySelector: e => e, orderComparer: StringComparer.OrdinalIgnoreCase, sequenceComparer: StringComparer.OrdinalIgnoreCase));
        }
        public override int GetHashCode()
        {
            var hashCode = new HashCodeCombiner();

            hashCode.AddObject(FrameworkName);
            hashCode.AddObject(AssetTargetFallback);
            hashCode.AddSequence(Dependencies.OrderBy(s => s.Name, StringComparer.OrdinalIgnoreCase));
            hashCode.AddSequence(Imports);
            hashCode.AddObject(Warn);
            hashCode.AddSequence(DownloadDependencies.OrderBy(s => s.Name, StringComparer.OrdinalIgnoreCase));
            hashCode.AddSequence(FrameworkReferences.OrderBy(s => s.Name, ComparisonUtility.FrameworkReferenceNameComparer));
            if (RuntimeIdentifierGraphPath != null)
            {
                hashCode.AddObject(PathUtility.GetStringComparerBasedOnOS().GetHashCode(RuntimeIdentifierGraphPath));
            }
            hashCode.AddSequence(CentralPackageVersions.Values.OrderBy(s => s.Name, StringComparer.OrdinalIgnoreCase));
            hashCode.AddStringIgnoreCase(TargetAlias);
            return(hashCode.CombinedHash);
        }
Beispiel #5
0
        public bool Equals(TargetFrameworkInformation other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(EqualityUtility.EqualsWithNullCheck(FrameworkName, other.FrameworkName) &&
                   Dependencies.OrderedEquals(other.Dependencies, dependency => dependency.Name, StringComparer.OrdinalIgnoreCase) &&
                   Imports.SequenceEqualWithNullCheck(other.Imports) &&
                   AssetTargetFallback == other.AssetTargetFallback &&
                   DownloadDependencies.OrderedEquals(other.DownloadDependencies, dep => dep) &&
                   FrameworkReferences.OrderedEquals(other.FrameworkReferences, fr => fr) &&
                   string.Equals(RuntimeIdentifierGraphPath, other.RuntimeIdentifierGraphPath));
        }