26 types derived from EqualityComparer
illink (2)
installer.tasks (1)
StaticFileRegeneration\TpnSection.cs (1)
11public class ByHeaderNameComparer : EqualityComparer<TpnSection>
Microsoft.CodeAnalysis (3)
CodeGen\PrivateImplementationDetails.cs (2)
505private sealed class DataAndUShortEqualityComparer : EqualityComparer<(ImmutableArray<byte> Data, ushort Value)> 519private sealed class ConstantValueAndUShortEqualityComparer : EqualityComparer<(ImmutableArray<ConstantValue> Constants, ushort Value)>
SwitchConstantValueHelper.cs (1)
97public class SwitchLabelsComparer : EqualityComparer<object>
Microsoft.CodeAnalysis.CSharp (4)
Binder\Semantics\OverloadResolution\MethodTypeInference.cs (1)
3446private sealed class EqualsIgnoringDynamicTupleNamesAndNullabilityComparer : EqualityComparer<TypeWithAnnotations>
FlowAnalysis\DefiniteAssignment.cs (1)
669private sealed class SameDiagnosticComparer : EqualityComparer<Diagnostic>
Symbols\SymbolEqualityComparer.cs (1)
12internal sealed class SymbolEqualityComparer : EqualityComparer<Symbol>
Symbols\TypeWithAnnotations.cs (1)
390internal sealed class EqualsComparer : EqualityComparer<TypeWithAnnotations>
Microsoft.CodeAnalysis.UnitTests (1)
Collections\ImmutableSegmentedDictionaryTest.cs (1)
360private class MyStringOrdinalComparer : EqualityComparer<CaseInsensitiveString?>
Microsoft.DotNet.Build.Tasks.Packaging (1)
GenerateNuSpec.cs (1)
279private class FrameworkAssemblyReferenceComparer : EqualityComparer<FrameworkAssemblyReference>
Microsoft.ML.TimeSeries (1)
RootCauseAnalyzer.cs (1)
804internal class DimensionComparer : EqualityComparer<Dictionary<string, object>>
System.Private.CoreLib (13)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\EqualityComparer.cs (7)
86internal sealed class DelegateEqualityComparer<T> : EqualityComparer<T> 117public sealed partial class GenericEqualityComparer<T> : EqualityComparer<T> where T : IEquatable<T>? 146public sealed partial class NullableEqualityComparer<T> : EqualityComparer<T?>, ISerializable where T : struct 186public sealed partial class ObjectEqualityComparer<T> : EqualityComparer<T> 215public sealed partial class ByteEqualityComparer : EqualityComparer<byte> 236public sealed partial class EnumEqualityComparer<T> : EqualityComparer<T>, ISerializable where T : struct, Enum 271EqualityComparer<string>,
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\RandomizedStringEqualityComparer.cs (1)
15internal abstract class RandomizedStringEqualityComparer : EqualityComparer<string?>, IInternalStringEqualityComparer
src\System\Collections\Generic\EqualityComparer.CoreCLR.cs (5)
16public sealed partial class GenericEqualityComparer<T> : EqualityComparer<T> where T : IEquatable<T>? 59public sealed partial class NullableEqualityComparer<T> : EqualityComparer<T?> where T : struct 102public sealed partial class ObjectEqualityComparer<T> : EqualityComparer<T> 145public sealed partial class ByteEqualityComparer : EqualityComparer<byte> 162public sealed partial class EnumEqualityComparer<T> : EqualityComparer<T> where T : struct, Enum
959 references to EqualityComparer
Aspire.Dashboard (3)
Model\Otlp\SelectViewModel.cs (1)
29return EqualityComparer<T>.Default.Equals(Id, other.Id);
Model\StructuredLogsViewModel.cs (1)
68if (EqualityComparer<T>.Default.Equals(field, value))
Model\TracesViewModel.cs (1)
66if (EqualityComparer<T>.Default.Equals(field, value))
dotnet-dev-certs (2)
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (2)
424EqualityComparer<string>.Default.Equals(x?.Thumbprint, y?.Thumbprint); 428EqualityComparer<string>.Default.GetHashCode(obj.Thumbprint);
dotnet-svcutil-lib (4)
FrameworkFork\System.ServiceModel\System\IdentityModel\Claims\Claim.cs (1)
76return EqualityComparer<Claim>.Default;
FrameworkFork\System.ServiceModel\System\ServiceModel\SynchronizedKeyedCollection.cs (3)
23_comparer = EqualityComparer<K>.Default; 30_comparer = EqualityComparer<K>.Default; 167return EqualityComparer<T>.Default.Equals(item, itemInDict);
illink (2)
ILLink.RoslynAnalyzer (2)
src\tools\illink\src\ILLink.Shared\DataFlow\ValueSet.cs (2)
187 return EqualityComparer<TValue>.Default.Equals (value, otherValue); 222 return EqualityComparer<TValue>.Default.Equals (value, thisValue);
Microsoft.Analyzers.Local (1)
ApiLifecycle\Json\JsonValue.cs (1)
584var r = _reference != null ? EqualityComparer<object>.Default.GetHashCode(_reference) : 1;
Microsoft.Arcade.Test.Common (1)
DiffUtil.cs (1)
38public static readonly LCS<T> Default = new LCS<T>((left, right) => EqualityComparer<T>.Default.Equals(left, right));
Microsoft.AspNetCore.App.Analyzers (3)
Infrastructure\EmbeddedSyntax\EmbeddedDiagnostic.cs (2)
39hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Message); 40hashCode = hashCode * -1521134295 + EqualityComparer<TextSpan>.Default.GetHashCode(Span);
Infrastructure\RoutePattern\RoutePatternHelpers.cs (1)
27if (EqualityComparer<TSyntaxKind>.Default.Equals(nodeOrToken.Kind, kind))
Microsoft.AspNetCore.Components (2)
src\Http\Http.Abstractions\src\Routing\RouteValueDictionary.cs (2)
413return TryGetValue(item.Key, out var value) && EqualityComparer<object>.Default.Equals(value, item.Value); 497if (index >= 0 && EqualityComparer<object>.Default.Equals(array[index].Value, item.Value))
Microsoft.AspNetCore.Components.Endpoints (4)
Builder\RazorComponentDataSourceOptions.cs (2)
16internal static readonly EqualityComparer<IComponentRenderMode> RenderModeComparer = EqualityComparer<IComponentRenderMode>
Discovery\ComponentBuilder.cs (1)
37EqualityComparer<Type>.Default.Equals(ComponentType, other.ComponentType);
Discovery\PageComponentBuilder.cs (1)
65EqualityComparer<Type>.Default.Equals(PageType, other.PageType);
Microsoft.AspNetCore.Components.Endpoints.Tests (2)
Binding\FormDataMapperTests.cs (2)
2280public static bool operator ==(Point left, Point right) => EqualityComparer<Point>.Default.Equals(left, right); 2328public static bool operator ==(ValuePoint left, ValuePoint right) => EqualityComparer<ValuePoint>.Default.Equals(left, right);
Microsoft.AspNetCore.Components.Web (1)
Forms\InputBase.cs (1)
82var hasChanged = !EqualityComparer<TValue>.Default.Equals(value, Value);
Microsoft.AspNetCore.DeveloperCertificates.XPlat (2)
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (2)
424EqualityComparer<string>.Default.Equals(x?.Thumbprint, y?.Thumbprint); 428EqualityComparer<string>.Default.GetHashCode(obj.Thumbprint);
Microsoft.AspNetCore.Http (5)
src\Shared\Dictionary\AdaptiveCapacityDictionary.cs (5)
34: this(0, EqualityComparer<TKey>.Default) 52: this(capacity, EqualityComparer<TKey>.Default) 69_comparer = EqualityComparer<TKey>.Default; 271return TryGetValue(item.Key, out var value) && EqualityComparer<object>.Default.Equals(value, item.Value); 357if (index >= 0 && EqualityComparer<TValue>.Default.Equals(array[index].Value, item.Value))
Microsoft.AspNetCore.Http.Abstractions (2)
Routing\RouteValueDictionary.cs (2)
413return TryGetValue(item.Key, out var value) && EqualityComparer<object>.Default.Equals(value, item.Value); 497if (index >= 0 && EqualityComparer<object>.Default.Equals(array[index].Value, item.Value))
Microsoft.AspNetCore.Mvc.RazorPages (1)
ApplicationModels\PageApplicationModel.cs (1)
44EqualityComparer<object>.Default);
Microsoft.AspNetCore.Razor.Runtime (1)
Runtime\TagHelpers\TagHelperScopeManager.cs (1)
61comparer: EqualityComparer<object>.Default);
Microsoft.AspNetCore.Server.Kestrel.Core (2)
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (2)
424EqualityComparer<string>.Default.Equals(x?.Thumbprint, y?.Thumbprint); 428EqualityComparer<string>.Default.GetHashCode(obj.Thumbprint);
Microsoft.AspNetCore.Shared.Tests (5)
src\Shared\Dictionary\AdaptiveCapacityDictionary.cs (5)
34: this(0, EqualityComparer<TKey>.Default) 52: this(capacity, EqualityComparer<TKey>.Default) 69_comparer = EqualityComparer<TKey>.Default; 271return TryGetValue(item.Key, out var value) && EqualityComparer<object>.Default.Equals(value, item.Value); 357if (index >= 0 && EqualityComparer<TValue>.Default.Equals(array[index].Value, item.Value))
Microsoft.Build (17)
BackEnd\Components\SdkResolution\SdkResult.cs (2)
113EqualityComparer<SdkReference>.Default.Equals(_sdkReference, result._sdkReference)) 161hashCode = (hashCode * -1521134295) + EqualityComparer<SdkReference>.Default.GetHashCode(_sdkReference);
Collections\ArrayDictionary.cs (2)
80private IEqualityComparer<TKey> KeyComparer => EqualityComparer<TKey>.Default; 82private IEqualityComparer<TValue> ValueComparer => EqualityComparer<TValue>.Default;
Collections\CopyOnWritePropertyDictionary.cs (3)
182!EqualityComparer<T>.Default.Equals(thisProp, thatProp)) 232!EqualityComparer<T>.Default.Equals(thisProp, thatProp)) 284return EqualityComparer<T>.Default.Equals(value, item.Value);
Graph\GraphBuilder.cs (1)
69IEqualityComparer<ConfigurationMetadata> configComparer = EqualityComparer<ConfigurationMetadata>.Default;
Instance\ImmutableProjectCollections\ImmutablePropertyCollectionConverter.cs (2)
51!EqualityComparer<TCached>.Default.Equals(propKvp.Value, otherProperty)) 62!EqualityComparer<T>.Default.Equals(thisProp, thatProp))
Logging\EvaluationLocationIdAgnosticComparer.cs (7)
41hashCode = (hashCode * -1521134295) + EqualityComparer<EvaluationPass>.Default.GetHashCode(obj.EvaluationPass); 42hashCode = (hashCode * -1521134295) + EqualityComparer<string>.Default.GetHashCode(obj.EvaluationPassDescription); 43hashCode = (hashCode * -1521134295) + EqualityComparer<string>.Default.GetHashCode(obj.File); 44hashCode = (hashCode * -1521134295) + EqualityComparer<int?>.Default.GetHashCode(obj.Line); 45hashCode = (hashCode * -1521134295) + EqualityComparer<string>.Default.GetHashCode(obj.ElementName); 46hashCode = (hashCode * -1521134295) + EqualityComparer<string>.Default.GetHashCode(obj.ElementDescription); 47hashCode = (hashCode * -1521134295) + EqualityComparer<EvaluationLocationKind>.Default.GetHashCode(obj.Kind);
Microsoft.Build.Engine.UnitTests (5)
BackEnd\ConfigCache_Tests.cs (1)
107Assert.Equal(copiedConfigurations, initialConfigurations, EqualityComparer<BuildRequestConfiguration>.Default);
BackEnd\ConfigurationMetadata_Tests.cs (1)
138Assert.Equal(copy.GlobalProperties, initial.GlobalProperties, EqualityComparer<ProjectPropertyInstance>.Default);
TestComparers\ProjectInstanceModelTestComparers.cs (3)
27Assert.Equal(x.Properties, y.Properties, EqualityComparer<ProjectPropertyInstance>.Default); 28Assert.Equal(x.TestEnvironmentalProperties, y.TestEnvironmentalProperties, EqualityComparer<ProjectPropertyInstance>.Default); 249Assert.Equal(x.Metadata, y.Metadata, EqualityComparer<ProjectMetadataInstance>.Default);
Microsoft.Build.Framework (35)
ImmutableSegmentedDictionary`2.cs (2)
196&& EqualityComparer<TValue>.Default.Equals(value, pair.Value); 279keyComparer ??= EqualityComparer<TKey>.Default;
ImmutableSegmentedDictionary`2+Builder.cs (1)
135&& EqualityComparer<TValue>.Default.Equals(value, item.Value);
Profiler\EvaluationLocation.cs (8)
260hashCode = (hashCode * -1521134295) + EqualityComparer<long?>.Default.GetHashCode(ParentId); 261hashCode = (hashCode * -1521134295) + EqualityComparer<EvaluationPass>.Default.GetHashCode(EvaluationPass); 262hashCode = (hashCode * -1521134295) + EqualityComparer<string>.Default.GetHashCode(EvaluationPassDescription); 263hashCode = (hashCode * -1521134295) + EqualityComparer<string>.Default.GetHashCode(File); 264hashCode = (hashCode * -1521134295) + EqualityComparer<int?>.Default.GetHashCode(Line); 265hashCode = (hashCode * -1521134295) + EqualityComparer<string>.Default.GetHashCode(ElementName); 266hashCode = (hashCode * -1521134295) + EqualityComparer<string>.Default.GetHashCode(ElementDescription); 267hashCode = (hashCode * -1521134295) + EqualityComparer<EvaluationLocationKind>.Default.GetHashCode(Kind);
Profiler\ProfilerResult.cs (2)
84hashCode = (hashCode * -1521134295) + EqualityComparer<TimeSpan>.Default.GetHashCode(InclusiveTime); 85hashCode = (hashCode * -1521134295) + EqualityComparer<TimeSpan>.Default.GetHashCode(ExclusiveTime);
RoslynImmutableInterlocked.cs (2)
438var valueComparer = EqualityComparer<TValue>.Default;
SegmentedArray.cs (3)
229if (comparer is null || comparer == EqualityComparer<T>.Default) 305if (comparer is null || comparer == EqualityComparer<T>.Default) 310if (EqualityComparer<T>.Default.Equals(array[i], value))
SegmentedDictionary`2.cs (17)
53/// <see cref="EqualityComparer{T}.Default"/> doesn't devirtualize on .NET Framework, so we always ensure 89if (comparer != null && comparer != EqualityComparer<TKey>.Default) // first check for null to avoid forcing default comparer instantiation unnecessarily 96_comparer ??= EqualityComparer<TKey>.Default; 161return _comparer ?? EqualityComparer<TKey>.Default; 211if (!RoslynUnsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 222if (!RoslynUnsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 269if (entries[i]._next >= -1 && EqualityComparer<TValue>.Default.Equals(entries[i]._value, value)) 280var defaultComparer = EqualityComparer<TValue>.Default; 360if (entry._hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entry._key, key)) 379var defaultComparer = EqualityComparer<TKey>.Default; 505if (entries[i]._hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entries[i]._key, key)) 537var defaultComparer = EqualityComparer<TKey>.Default; 698if (entry._hashCode == hashCode && (_comparer?.Equals(entry._key, key) ?? EqualityComparer<TKey>.Default.Equals(entry._key, key))) 770if (entry._hashCode == hashCode && (_comparer?.Equals(entry._key, key) ?? EqualityComparer<TKey>.Default.Equals(entry._key, key)))
Microsoft.CodeAnalysis (74)
Collections\ConcurrentCache.cs (1)
43: this(size, EqualityComparer<TKey>.Default) { }
Collections\ImmutableArrayExtensions.cs (2)
985return EqualityComparer<T>.Default.Equals(array[0], array[1]); 1021comparer ??= EqualityComparer<T>.Default;
Collections\OrderPreservingMultiDictionary.cs (1)
266? EqualityComparer<V>.Default.Equals(item, (V)_value)
Collections\SmallDictionary.cs (1)
44public SmallDictionary() : this(EqualityComparer<K>.Default) { }
Collections\TemporaryArray`1.cs (1)
254equalityComparer ??= EqualityComparer<T>.Default;
Diagnostic\ProgrammaticSuppressionInfo.cs (1)
31this.Suppressions.SetEquals(other.Suppressions, EqualityComparer<Suppression>.Default);
DiagnosticAnalyzer\AdditionalTextValueProvider.cs (2)
22/// If no comparer is provided, then <see cref="EqualityComparer{T}.Default"/> is used by default.</param> 25CoreValueProvider = new AnalysisValueProvider<AdditionalText, TValue>(computeValue, additionalTextComparer ?? EqualityComparer<AdditionalText>.Default);
DiagnosticAnalyzer\AnalysisValueProvider.cs (1)
28KeyComparer = keyComparer ?? EqualityComparer<TKey>.Default;
DiagnosticAnalyzer\Suppression.cs (4)
72return EqualityComparer<SuppressionDescriptor>.Default.Equals(Descriptor, other.Descriptor) 73&& EqualityComparer<Diagnostic>.Default.Equals(SuppressedDiagnostic, other.SuppressedDiagnostic); 79EqualityComparer<SuppressionDescriptor>.Default.GetHashCode(Descriptor), 80EqualityComparer<Diagnostic>.Default.GetHashCode(SuppressedDiagnostic));
InternalUtilities\EnumerableExtensions.cs (2)
538IReadOnlyList<T> readOnlyList => IndexOf(readOnlyList, value, EqualityComparer<T>.Default), 539_ => EnumeratingIndexOf(sequence, value, EqualityComparer<T>.Default)
InternalUtilities\IReadOnlyListExtensions.cs (1)
13comparer ??= EqualityComparer<T>.Default;
InternalUtilities\OneOrMany.cs (5)
111=> HasOneItem ? EqualityComparer<T>.Default.Equals(item, _one) : _many.Contains(item); 117return EqualityComparer<T>.Default.Equals(item, _one) ? Empty : this; 120return OneOrMany.Create(_many.WhereAsArray(static (value, item) => !EqualityComparer<T>.Default.Equals(value, item), item)); 192comparer ??= EqualityComparer<T>.Default; 210comparer ??= EqualityComparer<T>.Default;
InternalUtilities\SpecializedCollections.Singleton.Collection`1.cs (1)
36return EqualityComparer<T>.Default.Equals(_loneValue, item);
MetadataReference\AssemblyIdentity.cs (1)
372return EqualityComparer<AssemblyIdentity>.Default.Equals(left, right);
SourceGeneration\Nodes\BatchNode.cs (2)
25_comparer = comparer ?? EqualityComparer<ImmutableArray<TInput>>.Default; 80if (!EqualityComparer<TInput>.Default.Equals(entry.Item, previousItems[indexInPrevious]))
SourceGeneration\Nodes\HostOutputNode.cs (2)
41return previousTable.CreateCachedTableWithUpdatedSteps(sourceTable, stepName, EqualityComparer<OutputType>.Default); 46var nodeTable = graphState.CreateTableBuilder(previousTable, stepName, EqualityComparer<OutputType>.Default);
SourceGeneration\Nodes\InputNode.cs (3)
38_comparer = comparer ?? EqualityComparer<T>.Default; 39_inputComparer = inputComparer ?? EqualityComparer<T>.Default; 51var itemsSet = (_inputComparer == EqualityComparer<T>.Default) ? PooledHashSet<T>.GetInstance() : new HashSet<T>(_inputComparer);
SourceGeneration\Nodes\NodeStateTable.cs (1)
259_equalityComparer = equalityComparer ?? EqualityComparer<T>.Default;
SourceGeneration\Nodes\PredicateSyntaxStrategy.cs (1)
33public ISyntaxInputBuilder GetBuilder(StateTableStore table, object key, bool trackIncrementalSteps, string? name, IEqualityComparer<T>? comparer) => new Builder(this, key, table, trackIncrementalSteps, name, comparer ?? EqualityComparer<T>.Default);
SourceGeneration\Nodes\SourceOutputNode.cs (3)
49return previousTable.CreateCachedTableWithUpdatedSteps(sourceTable, stepName, EqualityComparer<TOutput>.Default); 54var tableBuilder = graphState.CreateTableBuilder(previousTable, stepName, EqualityComparer<TOutput>.Default); 74if (entry.State != EntryState.Modified || !tableBuilder.TryModifyEntry(sourcesAndDiagnostics, EqualityComparer<TOutput>.Default, stopwatch.Elapsed, inputs, entry.State))
SourceGeneration\Nodes\SyntaxInputNode.cs (1)
27_comparer = comparer ?? EqualityComparer<T>.Default;
SourceGeneration\Nodes\TransformNode.cs (1)
36_comparer = comparer ?? EqualityComparer<TOutput>.Default;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2.cs (2)
184&& EqualityComparer<TValue>.Default.Equals(value, pair.Value); 267keyComparer ??= EqualityComparer<TKey>.Default;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueBuilder.cs (1)
147&& EqualityComparer<TValue>.Default.Equals(value, item.Value);
src\Dependencies\Collections\ImmutableSegmentedHashSet`1.cs (1)
307equalityComparer ??= EqualityComparer<T>.Default;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+ValueBuilder.cs (2)
45if (Equals(KeyComparer, value ?? EqualityComparer<T>.Default)) 48_mutableSet = new SegmentedHashSet<T>(ReadOnlySet, value ?? EqualityComparer<T>.Default);
src\Dependencies\Collections\Internal\SegmentedHashSetEqualityComparer`1.cs (3)
33var defaultComparer = EqualityComparer<T>.Default; 86public override int GetHashCode() => EqualityComparer<T>.Default.GetHashCode();
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (2)
559var valueComparer = EqualityComparer<TValue>.Default;
src\Dependencies\Collections\SegmentedArray.cs (3)
235if (comparer is null || comparer == EqualityComparer<T>.Default) 311if (comparer is null || comparer == EqualityComparer<T>.Default) 316if (EqualityComparer<T>.Default.Equals(array[i], value))
src\Dependencies\Collections\SegmentedDictionary`2.cs (12)
102_comparer = comparer ?? EqualityComparer<TKey>.Default; 105comparer != EqualityComparer<TKey>.Default) 224return _comparer ?? EqualityComparer<TKey>.Default; 274if (!RoslynUnsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 285if (!RoslynUnsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 332if (entries[i]._next >= -1 && EqualityComparer<TValue>.Default.Equals(entries[i]._value, value)) 343var defaultComparer = EqualityComparer<TValue>.Default; 429if (entry._hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entry._key, key)) 543if (entries[i]._hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entries[i]._key, key)) 699(SupportsComparerDevirtualization && typeof(TKey).IsValueType && comparer == null ? EqualityComparer<TKey>.Default.Equals(entry._key, key) : comparer!.Equals(entry._key, key))) 776(SupportsComparerDevirtualization && typeof(TKey).IsValueType && comparer == null ? EqualityComparer<TKey>.Default.Equals(entry._key, key) : comparer!.Equals(entry._key, key)))
src\Dependencies\Collections\SegmentedHashSet`1.cs (6)
85_comparer = comparer ?? EqualityComparer<T>.Default; 88comparer != EqualityComparer<T>.Default) 240if (entry._hashCode == hashCode && EqualityComparer<T>.Default.Equals(entry._value, item)) 313if (entry._hashCode == hashCode && (comparer?.Equals(entry._value, item) ?? EqualityComparer<T>.Default.Equals(entry._value, item))) 867return _comparer ?? EqualityComparer<T>.Default; 1022if (entry._hashCode == hashCode && EqualityComparer<T>.Default.Equals(entry._value, value))
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
40private static readonly ObjectPool<PooledDictionary<K, V>> s_poolInstance = CreatePool(EqualityComparer<K>.Default);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
29private static readonly ObjectPool<PooledHashSet<T>> s_poolInstance = CreatePool(EqualityComparer<T>.Default);
Text\TextChange.cs (2)
65EqualityComparer<TextSpan>.Default.Equals(this.Span, other.Span) && 66EqualityComparer<string>.Default.Equals(this.NewText, other.NewText);
Microsoft.CodeAnalysis.CodeStyle (61)
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (1)
41var equalityComparerType = compilation.GetBestTypeByMetadataName(typeof(EqualityComparer<>).FullName!);
src\Compilers\Core\Portable\Collections\ImmutableArrayExtensions.cs (2)
985return EqualityComparer<T>.Default.Equals(array[0], array[1]); 1021comparer ??= EqualityComparer<T>.Default;
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (1)
266? EqualityComparer<V>.Default.Equals(item, (V)_value)
src\Compilers\Core\Portable\Collections\TemporaryArray`1.cs (1)
254equalityComparer ??= EqualityComparer<T>.Default;
src\Compilers\Core\Portable\InternalUtilities\EnumerableExtensions.cs (2)
538IReadOnlyList<T> readOnlyList => IndexOf(readOnlyList, value, EqualityComparer<T>.Default), 539_ => EnumeratingIndexOf(sequence, value, EqualityComparer<T>.Default)
src\Compilers\Core\Portable\InternalUtilities\OneOrMany.cs (5)
111=> HasOneItem ? EqualityComparer<T>.Default.Equals(item, _one) : _many.Contains(item); 117return EqualityComparer<T>.Default.Equals(item, _one) ? Empty : this; 120return OneOrMany.Create(_many.WhereAsArray(static (value, item) => !EqualityComparer<T>.Default.Equals(value, item), item)); 192comparer ??= EqualityComparer<T>.Default; 210comparer ??= EqualityComparer<T>.Default;
src\Compilers\Core\Portable\InternalUtilities\SpecializedCollections.Singleton.Collection`1.cs (1)
36return EqualityComparer<T>.Default.Equals(_loneValue, item);
src\Dependencies\Collections\ImmutableSegmentedDictionary`2.cs (2)
184&& EqualityComparer<TValue>.Default.Equals(value, pair.Value); 267keyComparer ??= EqualityComparer<TKey>.Default;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueBuilder.cs (1)
147&& EqualityComparer<TValue>.Default.Equals(value, item.Value);
src\Dependencies\Collections\ImmutableSegmentedHashSet`1.cs (1)
307equalityComparer ??= EqualityComparer<T>.Default;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+ValueBuilder.cs (2)
45if (Equals(KeyComparer, value ?? EqualityComparer<T>.Default)) 48_mutableSet = new SegmentedHashSet<T>(ReadOnlySet, value ?? EqualityComparer<T>.Default);
src\Dependencies\Collections\Internal\SegmentedHashSetEqualityComparer`1.cs (3)
33var defaultComparer = EqualityComparer<T>.Default; 86public override int GetHashCode() => EqualityComparer<T>.Default.GetHashCode();
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (2)
559var valueComparer = EqualityComparer<TValue>.Default;
src\Dependencies\Collections\SegmentedArray.cs (3)
235if (comparer is null || comparer == EqualityComparer<T>.Default) 311if (comparer is null || comparer == EqualityComparer<T>.Default) 316if (EqualityComparer<T>.Default.Equals(array[i], value))
src\Dependencies\Collections\SegmentedDictionary`2.cs (13)
57/// <see cref="EqualityComparer{T}.Default"/> doesn't devirtualize on .NET Framework, so we always ensure 102_comparer = comparer ?? EqualityComparer<TKey>.Default; 105comparer != EqualityComparer<TKey>.Default) 224return _comparer ?? EqualityComparer<TKey>.Default; 274if (!RoslynUnsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 285if (!RoslynUnsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 332if (entries[i]._next >= -1 && EqualityComparer<TValue>.Default.Equals(entries[i]._value, value)) 343var defaultComparer = EqualityComparer<TValue>.Default; 429if (entry._hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entry._key, key)) 543if (entries[i]._hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entries[i]._key, key)) 699(SupportsComparerDevirtualization && typeof(TKey).IsValueType && comparer == null ? EqualityComparer<TKey>.Default.Equals(entry._key, key) : comparer!.Equals(entry._key, key))) 776(SupportsComparerDevirtualization && typeof(TKey).IsValueType && comparer == null ? EqualityComparer<TKey>.Default.Equals(entry._key, key) : comparer!.Equals(entry._key, key)))
src\Dependencies\Collections\SegmentedHashSet`1.cs (7)
64/// <see cref="EqualityComparer{T}.Default"/> doesn't devirtualize on .NET Framework, so we always ensure 85_comparer = comparer ?? EqualityComparer<T>.Default; 88comparer != EqualityComparer<T>.Default) 240if (entry._hashCode == hashCode && EqualityComparer<T>.Default.Equals(entry._value, item)) 313if (entry._hashCode == hashCode && (comparer?.Equals(entry._value, item) ?? EqualityComparer<T>.Default.Equals(entry._value, item))) 867return _comparer ?? EqualityComparer<T>.Default; 1022if (entry._hashCode == hashCode && EqualityComparer<T>.Default.Equals(entry._value, value))
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
40private static readonly ObjectPool<PooledDictionary<K, V>> s_poolInstance = CreatePool(EqualityComparer<K>.Default);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
29private static readonly ObjectPool<PooledHashSet<T>> s_poolInstance = CreatePool(EqualityComparer<T>.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
110return EqualityComparer<T>.Default.Equals(value, Value) ? this : new CodeStyleOption2<T>(value, Notification); 240&& EqualityComparer<T>.Default.Equals(Value, other.Value) 249=> unchecked((Notification.GetHashCode() * (int)0xA5555529) + EqualityComparer<T>.Default.GetHashCode(Value!));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (2)
48hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Message); 49hashCode = hashCode * -1521134295 + EqualityComparer<TextSpan>.Default.GetHashCode(Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ICompilationExtensions.cs (1)
103=> compilation.GetTypeByMetadataName(typeof(EqualityComparer<>).FullName!);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (1)
139return EqualityComparer<ISymbol>.Default.Equals(info1.Symbol, info2.Symbol);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ContextMutableIntervalTree.cs (2)
123if (EqualityComparer<T?>.Default.Equals(result, default)) 163if (EqualityComparer<T?>.Default.Equals(result, default) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\IDictionaryExtensions.cs (1)
217if (collection.Length == 1 && EqualityComparer<TValue>.Default.Equals(collection[0], value))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\IReadOnlyListExtensions.cs (1)
29if (EqualityComparer<T>.Default.Equals(list[index], value))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PooledBuilderExtensions.cs (1)
108return EqualityComparer<U>.Default.Equals(selector(builder[0]), selector(builder[1]));
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
81? factory.GenericName(nameof(EqualityComparer<int>), type)
Microsoft.CodeAnalysis.Collections.Package (34)
ImmutableSegmentedDictionary`2.cs (2)
184&& EqualityComparer<TValue>.Default.Equals(value, pair.Value); 267keyComparer ??= EqualityComparer<TKey>.Default;
ImmutableSegmentedDictionary`2+ValueBuilder.cs (1)
147&& EqualityComparer<TValue>.Default.Equals(value, item.Value);
ImmutableSegmentedHashSet`1.cs (1)
307equalityComparer ??= EqualityComparer<T>.Default;
ImmutableSegmentedHashSet`1+ValueBuilder.cs (2)
45if (Equals(KeyComparer, value ?? EqualityComparer<T>.Default)) 48_mutableSet = new SegmentedHashSet<T>(ReadOnlySet, value ?? EqualityComparer<T>.Default);
Internal\SegmentedHashSetEqualityComparer`1.cs (3)
33var defaultComparer = EqualityComparer<T>.Default; 86public override int GetHashCode() => EqualityComparer<T>.Default.GetHashCode();
RoslynImmutableInterlocked.cs (2)
559var valueComparer = EqualityComparer<TValue>.Default;
SegmentedArray.cs (3)
235if (comparer is null || comparer == EqualityComparer<T>.Default) 311if (comparer is null || comparer == EqualityComparer<T>.Default) 316if (EqualityComparer<T>.Default.Equals(array[i], value))
SegmentedDictionary`2.cs (13)
57/// <see cref="EqualityComparer{T}.Default"/> doesn't devirtualize on .NET Framework, so we always ensure 102_comparer = comparer ?? EqualityComparer<TKey>.Default; 105comparer != EqualityComparer<TKey>.Default) 224return _comparer ?? EqualityComparer<TKey>.Default; 274if (!RoslynUnsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 285if (!RoslynUnsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 332if (entries[i]._next >= -1 && EqualityComparer<TValue>.Default.Equals(entries[i]._value, value)) 343var defaultComparer = EqualityComparer<TValue>.Default; 429if (entry._hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entry._key, key)) 543if (entries[i]._hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entries[i]._key, key)) 699(SupportsComparerDevirtualization && typeof(TKey).IsValueType && comparer == null ? EqualityComparer<TKey>.Default.Equals(entry._key, key) : comparer!.Equals(entry._key, key))) 776(SupportsComparerDevirtualization && typeof(TKey).IsValueType && comparer == null ? EqualityComparer<TKey>.Default.Equals(entry._key, key) : comparer!.Equals(entry._key, key)))
SegmentedHashSet`1.cs (7)
64/// <see cref="EqualityComparer{T}.Default"/> doesn't devirtualize on .NET Framework, so we always ensure 85_comparer = comparer ?? EqualityComparer<T>.Default; 88comparer != EqualityComparer<T>.Default) 240if (entry._hashCode == hashCode && EqualityComparer<T>.Default.Equals(entry._value, item)) 313if (entry._hashCode == hashCode && (comparer?.Equals(entry._value, item) ?? EqualityComparer<T>.Default.Equals(entry._value, item))) 867return _comparer ?? EqualityComparer<T>.Default; 1022if (entry._hashCode == hashCode && EqualityComparer<T>.Default.Equals(entry._value, value))
Microsoft.CodeAnalysis.CSharp (16)
Binder\InMethodBinder.cs (1)
207parameterMap = new MultiDictionary<string, ParameterSymbol>(parameters.Length, EqualityComparer<string>.Default);
Binder\WithPrimaryConstructorParametersBinder.cs (1)
84parameterMap = new MultiDictionary<string, ParameterSymbol>(parameters.Length, EqualityComparer<string>.Default);
Compilation\SyntaxAndDeclarationManager.LazyState.cs (1)
56Debug.Assert(syntaxTrees.SetEquals(rootNamespaces.Keys.AsImmutable(), EqualityComparer<SyntaxTree>.Default));
FlowAnalysis\NullableWalker.cs (2)
1512var analyzedNullabilities = ImmutableDictionary.CreateBuilder<BoundExpression, (NullabilityInfo, TypeSymbol?)>(EqualityComparer<BoundExpression>.Default, NullabilityInfoTypeComparer.Instance); 1569var analyzedNullabilities = ImmutableDictionary.CreateBuilder<BoundExpression, (NullabilityInfo, TypeSymbol?)>(EqualityComparer<BoundExpression>.Default, NullabilityInfoTypeComparer.Instance);
Lowering\LocalRewriter\DelegateCacheContainer.cs (2)
93var symbolComparer = SymbolEqualityComparer.CLRSignature; 102var symbolComparer = SymbolEqualityComparer.CLRSignature;
Symbols\SymbolEqualityComparer.cs (9)
14internal static readonly EqualityComparer<Symbol> ConsiderEverything = new SymbolEqualityComparer(TypeCompareKind.ConsiderEverything); 16internal static readonly EqualityComparer<Symbol> IgnoringTupleNamesAndNullability = new SymbolEqualityComparer(TypeCompareKind.IgnoreTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes); 18internal static EqualityComparer<Symbol> IncludeNullability => ConsiderEverything; 23internal static readonly EqualityComparer<Symbol> IgnoringDynamicTupleNamesAndNullability = new SymbolEqualityComparer(TypeCompareKind.IgnoreDynamicAndTupleNames | TypeCompareKind.IgnoreNullableModifiersForReferenceTypes); 25internal static readonly EqualityComparer<Symbol> IgnoringNullable = new SymbolEqualityComparer(TypeCompareKind.IgnoreNullableModifiersForReferenceTypes); 27internal static readonly EqualityComparer<Symbol> ObliviousNullableModifierMatchesAny = new SymbolEqualityComparer(TypeCompareKind.ObliviousNullableModifierMatchesAny); 29internal static readonly EqualityComparer<Symbol> AllIgnoreOptions = new SymbolEqualityComparer(TypeCompareKind.AllIgnoreOptions); 31internal static readonly EqualityComparer<Symbol> AllIgnoreOptionsPlusNullableWithUnknownMatchesAny = 34internal static readonly EqualityComparer<Symbol> CLRSignature = new SymbolEqualityComparer(TypeCompareKind.CLRSignatureCompareOptions);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Rename\CSharpInlineRenameServiceTests.cs (1)
56=> EqualityComparer<ImmutableDictionary<string, ImmutableArray<(string filePath, string content)>>?>.Default.GetHashCode(obj);
Microsoft.CodeAnalysis.CSharp.Features (1)
Debugging\BreakpointResolver.cs (1)
20internal class BreakpointResolver(Solution solution, string text) : AbstractBreakpointResolver(solution, text, LanguageNames.CSharp, EqualityComparer<string>.Default)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (13)
Semantics\UnsafeTests.cs (2)
7876Assert.True(methodGroupSummary.MethodGroup.SetEquals(ImmutableArray.Create<IMethodSymbol>(structMethod1.GetPublicSymbol(), structMethod2.GetPublicSymbol()), EqualityComparer<IMethodSymbol>.Default)); 7941Assert.True(methodGroupSummary.MethodGroup.SetEquals(structMethods.GetPublicSymbols(), EqualityComparer<IMethodSymbol>.Default));
SourceGeneration\StateTableTests.cs (11)
85builder.TryModifyEntries(ImmutableArray.Create(10, 11), EqualityComparer<int>.Default, TimeSpan.Zero, default, EntryState.Modified); 87builder.TryModifyEntries(ImmutableArray.Create(20, 21, 22), EqualityComparer<int>.Default, TimeSpan.Zero, default, EntryState.Modified); 188Assert.True(builder.TryModifyEntries(ImmutableArray.Create(3, 2), EqualityComparer<int>.Default, TimeSpan.Zero, default, EntryState.Modified)); 189Assert.True(builder.TryModifyEntries(ImmutableArray<int>.Empty, EqualityComparer<int>.Default, TimeSpan.Zero, default, EntryState.Modified)); 190Assert.True(builder.TryModifyEntries(ImmutableArray.Create(3, 5), EqualityComparer<int>.Default, TimeSpan.Zero, default, EntryState.Modified)); 212Assert.True(builder.TryModifyEntry(1, EqualityComparer<int>.Default, TimeSpan.Zero, default, EntryState.Modified)); 213Assert.True(builder.TryModifyEntry(2, EqualityComparer<int>.Default, TimeSpan.Zero, default, EntryState.Modified)); 214Assert.True(builder.TryModifyEntry(5, EqualityComparer<int>.Default, TimeSpan.Zero, default, EntryState.Modified)); 215Assert.True(builder.TryModifyEntry(4, EqualityComparer<int>.Default, TimeSpan.Zero, default, EntryState.Modified)); 236Assert.True(builder.TryModifyEntry(1, EqualityComparer<int>.Default, TimeSpan.Zero, default, EntryState.Modified)); // ((1, EntryState.Cached)) 237Assert.True(builder.TryModifyEntry(4, EqualityComparer<int>.Default, TimeSpan.Zero, default, EntryState.Modified)); // ((4, EntryState.Modified))
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (18)
Compilation\GetSemanticInfoTests.cs (6)
1460Assert.True(bindInfo.CandidateSymbols.SetEquals(candidateIndexers, EqualityComparer<ISymbol>.Default)); 2848Assert.True(candidates.SetEquals(conversions, EqualityComparer<ISymbol>.Default)); 2939Assert.True(candidates.SetEquals(operators, EqualityComparer<ISymbol>.Default)); 3031Assert.True(candidates.SetEquals(operators, EqualityComparer<ISymbol>.Default)); 3105Assert.True(candidates.SetEquals(operators, EqualityComparer<ISymbol>.Default)); 3179Assert.True(candidates.SetEquals(operators, EqualityComparer<ISymbol>.Default));
Symbols\IndexerTests.cs (5)
2647Assert.True(indexerGroup.SetEquals(baseIndexerGroup.GetPublicSymbols(), EqualityComparer<IPropertySymbol>.Default)); 2651Assert.True(indexerGroup.SetEquals(derivedIndexerGroup.GetPublicSymbols(), EqualityComparer<IPropertySymbol>.Default)); 2725EqualityComparer<IPropertySymbol>.Default)); 2730EqualityComparer<IPropertySymbol>.Default)); 2735EqualityComparer<IPropertySymbol>.Default));
Symbols\Metadata\PE\TypeForwarders.cs (3)
1099Assert.True(actualNamespaces.SetEquals(expectedNamespaces, EqualityComparer<string>.Default)); 1163Assert.True(actualNamespaces.SetEquals(expectedNamespaces, EqualityComparer<string>.Default)); 1227Assert.True(actualNamespaces.SetEquals(expectedNamespaces, EqualityComparer<string>.Default));
Symbols\Source\BaseClassTests.cs (2)
1571Assert.True(@class.AllInterfaces().SetEquals(bothInterfaces, EqualityComparer<NamedTypeSymbol>.Default)); 1579Assert.True(cciInterfaces.SetEquals(bothInterfaces, EqualityComparer<NamedTypeSymbol>.Default));
Symbols\Source\DelegateTests.cs (2)
75Assert.Equal(d.Locations[0], d.DelegateInvokeMethod.Locations[0], EqualityComparer<Location>.Default); 76Assert.Equal(d.Locations[0], d.InstanceConstructors[0].Locations[0], EqualityComparer<Location>.Default);
Microsoft.CodeAnalysis.EditorFeatures (4)
IntelliSense\QuickInfo\QuickInfoHyperLink.cs (1)
34return EqualityComparer<Uri?>.Default.Equals(Uri, other?.Uri);
NavigationBar\NavigationBarController.cs (1)
111EqualityComparer<NavigationBarQueueItem>.Default,
Tagging\AbstractAsynchronousTaggerProvider.cs (1)
124=> EqualityComparer<TTag>.Default.Equals(tag1, tag2);
Tagging\AbstractAsynchronousTaggerProvider.TagSource.cs (1)
165EqualityComparer<TagSourceQueueItem>.Default,
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Collections\Immutable\Maps\MapTests.cs (1)
125=> EqualityComparer<T>.Default.Equals(x, y);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (2)
BackgroundWorkIndicator\BackgroundWorkIndicatorContext.cs (1)
114EqualityComparer<UIUpdateRequest>.Default,
InlineRename\UI\Adornment\RenameFlyoutViewModel.cs (1)
419if (EqualityComparer<T>.Default.Equals(field, newValue))
Microsoft.CodeAnalysis.Features (3)
Completion\CompletionService.ProviderManager.cs (1)
44EqualityComparer<IReadOnlyList<AnalyzerReference>>.Default,
Completion\Providers\AbstractSymbolCompletionProvider.cs (1)
117comparer: EqualityComparer<(string, string, string)>.Default,
src\Analyzers\Core\Analyzers\Helpers\HashCodeAnalyzer\HashCodeAnalyzer.cs (1)
41var equalityComparerType = compilation.GetBestTypeByMetadataName(typeof(EqualityComparer<>).FullName!);
Microsoft.CodeAnalysis.InteractiveHost (1)
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
29private static readonly ObjectPool<PooledHashSet<T>> s_poolInstance = CreatePool(EqualityComparer<T>.Default);
Microsoft.CodeAnalysis.LanguageServer (2)
HostWorkspace\LoadedProject.cs (2)
173EqualityComparer<CommandLineReference>.Default, // CommandLineReference already implements equality 191EqualityComparer<CommandLineAnalyzerReference>.Default, // CommandLineAnalyzerReference already implements equality
Microsoft.CodeAnalysis.LanguageServer.Protocol (18)
Handler\AbstractRefreshQueue.cs (1)
70equalityComparer: EqualityComparer<Uri?>.Default,
Protocol\Location.cs (3)
50EqualityComparer<Range>.Default.Equals(this.Range, other.Range); 57hashCode = (hashCode * -1521134295) + EqualityComparer<Uri>.Default.GetHashCode(this.Uri); 58hashCode = (hashCode * -1521134295) + EqualityComparer<Range>.Default.GetHashCode(this.Range);
Protocol\LocationLink.cs (3)
65&& EqualityComparer<Range>.Default.Equals(this.OriginSelectionRange, other.OriginSelectionRange) 67&& EqualityComparer<Range>.Default.Equals(this.TargetRange, other.TargetRange) 68&& EqualityComparer<Range>.Default.Equals(this.TargetSelectionRange, other.TargetSelectionRange);
Protocol\Range.cs (4)
71EqualityComparer<Position>.Default.Equals(this.Start, other.Start) && 72EqualityComparer<Position>.Default.Equals(this.End, other.End); 79hashCode = (hashCode * -1521134295) + EqualityComparer<Position>.Default.GetHashCode(this.Start); 80hashCode = (hashCode * -1521134295) + EqualityComparer<Position>.Default.GetHashCode(this.End);
Protocol\SumType.cs (6)
195return EqualityComparer<object?>.Default.Equals(this.Value, other.Value); 201return -1937169414 + EqualityComparer<object?>.Default.GetHashCode(this.Value); 478return EqualityComparer<object?>.Default.Equals(this.Value, other.Value); 484return -1937169414 + EqualityComparer<object?>.Default.GetHashCode(this.Value); 859return EqualityComparer<object?>.Default.Equals(this.Value, other.Value); 865return -1937169414 + EqualityComparer<object?>.Default.GetHashCode(this.Value);
Protocol\SymbolInformation.cs (1)
122&& EqualityComparer<Location>.Default.Equals(this.Location, other.Location)
Microsoft.CodeAnalysis.PooledObjects.Package (2)
PooledDictionary.cs (1)
40private static readonly ObjectPool<PooledDictionary<K, V>> s_poolInstance = CreatePool(EqualityComparer<K>.Default);
PooledHashSet.cs (1)
29private static readonly ObjectPool<PooledHashSet<T>> s_poolInstance = CreatePool(EqualityComparer<T>.Default);
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Services\SemanticClassification\RemoteSemanticClassificationService.Caching.cs (1)
64EqualityComparer<(Document, ClassificationType, ClassificationOptions)>.Default,
Microsoft.CodeAnalysis.Test.Utilities (5)
Assert\DiffUtil.cs (1)
41public static readonly LCS<T> Default = new LCS<T>(EqualityComparer<T>.Default);
Mocks\TestEqualityComparer.cs (2)
16=> (equals ?? EqualityComparer<T>.Default.Equals)(x, y); 19=> (getHashCode ?? EqualityComparer<T>.Default.GetHashCode!)(obj);
PDB\DeterministicBuildCompilationTestHelpers.cs (1)
27bool expectedIsDefault = (isDefault != null) ? isDefault(expectedValue) : EqualityComparer<T>.Default.Equals(expectedValue, default);
SourceGeneration\LambdaComparer.cs (1)
24public int GetHashCode([DisallowNull] T obj) => _hashCode.HasValue ? _hashCode.Value : EqualityComparer<T>.Default.GetHashCode(obj);
Microsoft.CodeAnalysis.UnitTests (42)
CachingLookupTests.cs (2)
299lookup = new CachingDictionary<int, FullyPopulateRaceHelper>(getElementsOfKey, getKeys, EqualityComparer<int>.Default); 336lookup = new CachingDictionary<int, FullyPopulateRaceHelper>(getElementsOfKey, getKeys, EqualityComparer<int>.Default);
Collections\BadHasher.cs (1)
25_equalityComparer = equalityComparer ?? EqualityComparer<T>.Default;
Collections\HashSet\SegmentedHashSet_Generic_Tests`1.cs (4)
68Assert.Equal(EqualityComparer<T>.Default, set.Comparer); 79Assert.Equal(EqualityComparer<T>.Default, set.Comparer); 122Assert.Throws<ArgumentNullException>(() => new SegmentedHashSet<T>((IEnumerable<T>)null!, EqualityComparer<T>.Default)); 411Assert.Equal(EqualityComparer<T>.Default, set.Comparer);
Collections\HashSet\TestingTypes.cs (2)
389return EqualityComparer<T>.Default.Equals(x, y); 395return EqualityComparer<T>.Default.GetHashCode(obj!);
Collections\ImmutableDictionaryTestBase.cs (2)
124Assert.Equal(EqualityComparer<object>.Default.GetHashCode(dictionary), dictionary.GetHashCode()); 245Assert.Same(EqualityComparer<V>.Default, GetValueComparer(empty));
Collections\ImmutableSegmentedDictionaryBuilderTest.cs (3)
28Assert.Same(EqualityComparer<string>.Default, builder.KeyComparer); 183Assert.Same(EqualityComparer<string>.Default, builder.KeyComparer); 227Assert.Same(EqualityComparer<string>.Default, builder.KeyComparer);
Collections\ImmutableSegmentedDictionaryTest.cs (7)
97Assert.Same(EqualityComparer<string>.Default, dictionary.KeyComparer); 105Assert.Same(EqualityComparer<string>.Default, dictionary.KeyComparer); 120Assert.Same(EqualityComparer<string>.Default, dictionary.KeyComparer); 130Assert.Same(EqualityComparer<string>.Default, dictionary.KeyComparer); 174Assert.Same(EqualityComparer<string>.Default, map.KeyComparer); 217Assert.Same(EqualityComparer<string>.Default, map.KeyComparer); 341return EqualityComparer<TValue>.Default;
Collections\ImmutableSegmentedDictionaryTest.nonnetstandard.cs (1)
39Assert.Same(EqualityComparer<TKey>.Default, empty.GetKeyComparer());
Collections\ImmutableSegmentedHashSetBuilderTest.cs (3)
25Assert.Same(EqualityComparer<string>.Default, builder.KeyComparer); 133Assert.Same(EqualityComparer<string>.Default, builder.KeyComparer); 165Assert.Same(EqualityComparer<string>.Default, builder.KeyComparer);
Collections\ImmutableSegmentedHashSetTest.cs (4)
116Assert.Same(EqualityComparer<string>.Default, set.KeyComparer); 124Assert.Same(EqualityComparer<string>.Default, set.KeyComparer); 132Assert.Same(EqualityComparer<string>.Default, set.KeyComparer); 140Assert.Same(EqualityComparer<string>.Default, set.KeyComparer);
Collections\ImmutableSegmentedHashSetTest.nonnetstandard.cs (1)
46Assert.Same(comparer ?? EqualityComparer<T>.Default, GetEqualityComparer(emptySet));
Collections\ImmutableSetTest.cs (1)
156Assert.Equal(EqualityComparer<object>.Default.GetHashCode(Empty<int>()), Empty<int>().GetHashCode());
Collections\IndexOfTests.cs (10)
33Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(emptyCollection, 100, 1, 1, EqualityComparer<int>.Default)); 34Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(emptyCollection, 100, -1, 1, EqualityComparer<int>.Default)); 35Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(collection1256, 100, 1, 20, EqualityComparer<int>.Default)); 36Assert.Throws<ArgumentOutOfRangeException>(() => indexOfItemIndexCountEQ(collection1256, 100, 1, -1, EqualityComparer<int>.Default)); 102Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(emptyCollection, 100, 1, 1, EqualityComparer<int>.Default)); 103Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(emptyCollection, 100, -1, 1, EqualityComparer<int>.Default)); 104Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(collection1256, 100, 1, 20, EqualityComparer<int>.Default)); 105Assert.Throws<ArgumentOutOfRangeException>(() => lastIndexOfItemIndexCountEQ(collection1256, 100, 1, -1, EqualityComparer<int>.Default)); 113Assert.Equal(-1, lastIndexOfItemEQ(emptyCollection, 5, EqualityComparer<int>.Default)); 134actual = lastIndexOfItemEQ(factory(list), match, EqualityComparer<int>.Default);
Collections\List\TestBase.Generic.cs (1)
38protected virtual IEqualityComparer<T> GetIEqualityComparer() => EqualityComparer<T>.Default;
Microsoft.CodeAnalysis.Workspaces (71)
Editing\SyntaxGenerator.cs (1)
1520if (EqualityComparer<T>.Default.Equals(list[i], element))
FindSymbols\ReferenceLocation.cs (3)
116EqualityComparer<IAliasSymbol>.Default.Equals(this.Alias, other.Alias) && 117EqualityComparer<Location>.Default.Equals(this.Location, other.Location) && 118EqualityComparer<DocumentId>.Default.Equals(this.Document.Id, other.Document.Id) &&
FindSymbols\SymbolTree\SymbolTreeInfoCacheService.cs (1)
49EqualityComparer<ProjectId>.Default,
Shared\Utilities\AsyncBatchingWorkQueue`0.cs (1)
19CancellationToken cancellationToken) : AsyncBatchingWorkQueue<VoidResult>(delay, Convert(processBatchAsync), EqualityComparer<VoidResult>.Default, asyncListener, cancellationToken)
src\Compilers\Core\Portable\Collections\ImmutableArrayExtensions.cs (2)
985return EqualityComparer<T>.Default.Equals(array[0], array[1]); 1021comparer ??= EqualityComparer<T>.Default;
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (1)
266? EqualityComparer<V>.Default.Equals(item, (V)_value)
src\Compilers\Core\Portable\Collections\TemporaryArray`1.cs (1)
254equalityComparer ??= EqualityComparer<T>.Default;
src\Compilers\Core\Portable\InternalUtilities\EnumerableExtensions.cs (2)
538IReadOnlyList<T> readOnlyList => IndexOf(readOnlyList, value, EqualityComparer<T>.Default), 539_ => EnumeratingIndexOf(sequence, value, EqualityComparer<T>.Default)
src\Compilers\Core\Portable\InternalUtilities\OneOrMany.cs (5)
111=> HasOneItem ? EqualityComparer<T>.Default.Equals(item, _one) : _many.Contains(item); 117return EqualityComparer<T>.Default.Equals(item, _one) ? Empty : this; 120return OneOrMany.Create(_many.WhereAsArray(static (value, item) => !EqualityComparer<T>.Default.Equals(value, item), item)); 192comparer ??= EqualityComparer<T>.Default; 210comparer ??= EqualityComparer<T>.Default;
src\Compilers\Core\Portable\InternalUtilities\SpecializedCollections.Singleton.Collection`1.cs (1)
36return EqualityComparer<T>.Default.Equals(_loneValue, item);
src\Dependencies\Collections\ImmutableSegmentedDictionary`2.cs (2)
184&& EqualityComparer<TValue>.Default.Equals(value, pair.Value); 267keyComparer ??= EqualityComparer<TKey>.Default;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueBuilder.cs (1)
147&& EqualityComparer<TValue>.Default.Equals(value, item.Value);
src\Dependencies\Collections\ImmutableSegmentedHashSet`1.cs (1)
307equalityComparer ??= EqualityComparer<T>.Default;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+ValueBuilder.cs (2)
45if (Equals(KeyComparer, value ?? EqualityComparer<T>.Default)) 48_mutableSet = new SegmentedHashSet<T>(ReadOnlySet, value ?? EqualityComparer<T>.Default);
src\Dependencies\Collections\Internal\SegmentedHashSetEqualityComparer`1.cs (3)
33var defaultComparer = EqualityComparer<T>.Default; 86public override int GetHashCode() => EqualityComparer<T>.Default.GetHashCode();
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (2)
559var valueComparer = EqualityComparer<TValue>.Default;
src\Dependencies\Collections\SegmentedArray.cs (3)
235if (comparer is null || comparer == EqualityComparer<T>.Default) 311if (comparer is null || comparer == EqualityComparer<T>.Default) 316if (EqualityComparer<T>.Default.Equals(array[i], value))
src\Dependencies\Collections\SegmentedDictionary`2.cs (12)
102_comparer = comparer ?? EqualityComparer<TKey>.Default; 105comparer != EqualityComparer<TKey>.Default) 224return _comparer ?? EqualityComparer<TKey>.Default; 274if (!RoslynUnsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 285if (!RoslynUnsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 332if (entries[i]._next >= -1 && EqualityComparer<TValue>.Default.Equals(entries[i]._value, value)) 343var defaultComparer = EqualityComparer<TValue>.Default; 429if (entry._hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entry._key, key)) 543if (entries[i]._hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entries[i]._key, key)) 699(SupportsComparerDevirtualization && typeof(TKey).IsValueType && comparer == null ? EqualityComparer<TKey>.Default.Equals(entry._key, key) : comparer!.Equals(entry._key, key))) 776(SupportsComparerDevirtualization && typeof(TKey).IsValueType && comparer == null ? EqualityComparer<TKey>.Default.Equals(entry._key, key) : comparer!.Equals(entry._key, key)))
src\Dependencies\Collections\SegmentedHashSet`1.cs (6)
85_comparer = comparer ?? EqualityComparer<T>.Default; 88comparer != EqualityComparer<T>.Default) 240if (entry._hashCode == hashCode && EqualityComparer<T>.Default.Equals(entry._value, item)) 313if (entry._hashCode == hashCode && (comparer?.Equals(entry._value, item) ?? EqualityComparer<T>.Default.Equals(entry._value, item))) 867return _comparer ?? EqualityComparer<T>.Default; 1022if (entry._hashCode == hashCode && EqualityComparer<T>.Default.Equals(entry._value, value))
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
40private static readonly ObjectPool<PooledDictionary<K, V>> s_poolInstance = CreatePool(EqualityComparer<K>.Default);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
29private static readonly ObjectPool<PooledHashSet<T>> s_poolInstance = CreatePool(EqualityComparer<T>.Default);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
110return EqualityComparer<T>.Default.Equals(value, Value) ? this : new CodeStyleOption2<T>(value, Notification); 240&& EqualityComparer<T>.Default.Equals(Value, other.Value) 249=> unchecked((Notification.GetHashCode() * (int)0xA5555529) + EqualityComparer<T>.Default.GetHashCode(Value!));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\EmbeddedLanguages\Common\EmbeddedDiagnostic.cs (2)
48hashCode = hashCode * -1521134295 + EqualityComparer<string>.Default.GetHashCode(Message); 49hashCode = hashCode * -1521134295 + EqualityComparer<TextSpan>.Default.GetHashCode(Span);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ICompilationExtensions.cs (1)
103=> compilation.GetTypeByMetadataName(typeof(EqualityComparer<>).FullName!);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\SemanticEquivalence.cs (1)
139return EqualityComparer<ISymbol>.Default.Equals(info1.Symbol, info2.Symbol);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\ContextMutableIntervalTree.cs (2)
123if (EqualityComparer<T?>.Default.Equals(result, default)) 163if (EqualityComparer<T?>.Default.Equals(result, default) ||
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\IDictionaryExtensions.cs (1)
217if (collection.Length == 1 && EqualityComparer<TValue>.Default.Equals(collection[0], value))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\IReadOnlyListExtensions.cs (1)
29if (EqualityComparer<T>.Default.Equals(list[index], value))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\PooledBuilderExtensions.cs (1)
108return EqualityComparer<U>.Default.Equals(selector(builder[0]), selector(builder[1]));
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
81? factory.GenericName(nameof(EqualityComparer<int>), type)
Workspace\ProjectSystem\FileWatchedPortableExecutableReferenceFactory.cs (1)
62EqualityComparer<string>.Default,
Workspace\Solution\DocumentId.cs (1)
84=> EqualityComparer<DocumentId?>.Default.Equals(left, right);
Workspace\Solution\ProjectId.cs (1)
85=> EqualityComparer<ProjectId?>.Default.Equals(left, right);
Workspace\Solution\ProjectReference.cs (1)
57=> EqualityComparer<ProjectReference>.Default.Equals(left, right);
Workspace\Solution\SolutionId.cs (1)
72=> EqualityComparer<SolutionId>.Default.Equals(left, right);
Workspace\Workspace.cs (1)
92EqualityComparer<(ProjectId? projectId, bool forceRegeneration)>.Default,
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (48)
src\Compilers\Core\Portable\Collections\ImmutableArrayExtensions.cs (2)
985return EqualityComparer<T>.Default.Equals(array[0], array[1]); 1021comparer ??= EqualityComparer<T>.Default;
src\Compilers\Core\Portable\Collections\TemporaryArray`1.cs (1)
254equalityComparer ??= EqualityComparer<T>.Default;
src\Compilers\Core\Portable\InternalUtilities\EnumerableExtensions.cs (2)
538IReadOnlyList<T> readOnlyList => IndexOf(readOnlyList, value, EqualityComparer<T>.Default), 539_ => EnumeratingIndexOf(sequence, value, EqualityComparer<T>.Default)
src\Compilers\Core\Portable\InternalUtilities\IReadOnlyListExtensions.cs (1)
13comparer ??= EqualityComparer<T>.Default;
src\Compilers\Core\Portable\InternalUtilities\OneOrMany.cs (5)
111=> HasOneItem ? EqualityComparer<T>.Default.Equals(item, _one) : _many.Contains(item); 117return EqualityComparer<T>.Default.Equals(item, _one) ? Empty : this; 120return OneOrMany.Create(_many.WhereAsArray(static (value, item) => !EqualityComparer<T>.Default.Equals(value, item), item)); 192comparer ??= EqualityComparer<T>.Default; 210comparer ??= EqualityComparer<T>.Default;
src\Compilers\Core\Portable\InternalUtilities\SpecializedCollections.Singleton.Collection`1.cs (1)
36return EqualityComparer<T>.Default.Equals(_loneValue, item);
src\Dependencies\Collections\ImmutableSegmentedDictionary`2.cs (2)
184&& EqualityComparer<TValue>.Default.Equals(value, pair.Value); 267keyComparer ??= EqualityComparer<TKey>.Default;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueBuilder.cs (1)
147&& EqualityComparer<TValue>.Default.Equals(value, item.Value);
src\Dependencies\Collections\ImmutableSegmentedHashSet`1.cs (1)
307equalityComparer ??= EqualityComparer<T>.Default;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+ValueBuilder.cs (2)
45if (Equals(KeyComparer, value ?? EqualityComparer<T>.Default)) 48_mutableSet = new SegmentedHashSet<T>(ReadOnlySet, value ?? EqualityComparer<T>.Default);
src\Dependencies\Collections\Internal\SegmentedHashSetEqualityComparer`1.cs (3)
33var defaultComparer = EqualityComparer<T>.Default; 86public override int GetHashCode() => EqualityComparer<T>.Default.GetHashCode();
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (2)
559var valueComparer = EqualityComparer<TValue>.Default;
src\Dependencies\Collections\SegmentedArray.cs (3)
235if (comparer is null || comparer == EqualityComparer<T>.Default) 311if (comparer is null || comparer == EqualityComparer<T>.Default) 316if (EqualityComparer<T>.Default.Equals(array[i], value))
src\Dependencies\Collections\SegmentedDictionary`2.cs (13)
57/// <see cref="EqualityComparer{T}.Default"/> doesn't devirtualize on .NET Framework, so we always ensure 102_comparer = comparer ?? EqualityComparer<TKey>.Default; 105comparer != EqualityComparer<TKey>.Default) 224return _comparer ?? EqualityComparer<TKey>.Default; 274if (!RoslynUnsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 285if (!RoslynUnsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 332if (entries[i]._next >= -1 && EqualityComparer<TValue>.Default.Equals(entries[i]._value, value)) 343var defaultComparer = EqualityComparer<TValue>.Default; 429if (entry._hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entry._key, key)) 543if (entries[i]._hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entries[i]._key, key)) 699(SupportsComparerDevirtualization && typeof(TKey).IsValueType && comparer == null ? EqualityComparer<TKey>.Default.Equals(entry._key, key) : comparer!.Equals(entry._key, key))) 776(SupportsComparerDevirtualization && typeof(TKey).IsValueType && comparer == null ? EqualityComparer<TKey>.Default.Equals(entry._key, key) : comparer!.Equals(entry._key, key)))
src\Dependencies\Collections\SegmentedHashSet`1.cs (7)
64/// <see cref="EqualityComparer{T}.Default"/> doesn't devirtualize on .NET Framework, so we always ensure 85_comparer = comparer ?? EqualityComparer<T>.Default; 88comparer != EqualityComparer<T>.Default) 240if (entry._hashCode == hashCode && EqualityComparer<T>.Default.Equals(entry._value, item)) 313if (entry._hashCode == hashCode && (comparer?.Equals(entry._value, item) ?? EqualityComparer<T>.Default.Equals(entry._value, item))) 867return _comparer ?? EqualityComparer<T>.Default; 1022if (entry._hashCode == hashCode && EqualityComparer<T>.Default.Equals(entry._value, value))
src\Dependencies\PooledObjects\PooledDictionary.cs (1)
40private static readonly ObjectPool<PooledDictionary<K, V>> s_poolInstance = CreatePool(EqualityComparer<K>.Default);
src\Dependencies\PooledObjects\PooledHashSet.cs (1)
29private static readonly ObjectPool<PooledHashSet<T>> s_poolInstance = CreatePool(EqualityComparer<T>.Default);
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
UtilityTest\ReferenceHolderTests.cs (1)
61var expired = ReferenceHolder<object?>.TestAccessor.ReleasedWeak(hashCode: EqualityComparer<object?>.Default.GetHashCode(null!));
Microsoft.CSharp (2)
Microsoft\CSharp\RuntimeBinder\Semantics\Types\TypeTable.cs (2)
25EqualityComparer<TKey1>.Default.Equals(_pKey1, other._pKey1) 26&& EqualityComparer<TKey2>.Default.Equals(_pKey2, other._pKey2);
Microsoft.Data.Analysis (3)
DataFrameColumns\ArrowStringDataFrameColumn.cs (1)
494Dictionary<string, ICollection<long>> multimap = new Dictionary<string, ICollection<long>>(EqualityComparer<string>.Default);
DataFrameColumns\StringDataFrameColumn.cs (1)
412Dictionary<string, ICollection<long>> multimap = new Dictionary<string, ICollection<long>>(EqualityComparer<string>.Default);
PrimitiveDataFrameColumn.cs (1)
617Dictionary<T, ICollection<long>> multimap = new Dictionary<T, ICollection<long>>(EqualityComparer<T>.Default);
Microsoft.DotNet.NuGetRepack.Tests (1)
TestHelpers\DiffUtil.cs (1)
38public static readonly LCS<T> Default = new LCS<T>(EqualityComparer<T>.Default);
Microsoft.DotNet.XUnitAssert.Tests (1)
EqualityAssertsTests.cs (1)
1019 assertFailure(() => Assert.Equal(expected, actual, EqualityComparer<IEnumerable<int>>.Default));
Microsoft.Extensions.Logging.Generators (2)
src\libraries\Common\src\Roslyn\SyntaxValueProvider.ImmutableArrayValueComparer.cs (2)
18=> x.SequenceEqual(y, EqualityComparer<T>.Default); 24hashCode = Hash.Combine(hashCode, EqualityComparer<T>.Default.GetHashCode(value!));
Microsoft.Extensions.Telemetry (3)
src\Shared\Memoization\MemoizedFunction.cs (3)
53public bool Equals(MemoizedFunction<TParameter, TResult>.Arg other) => EqualityComparer<TParameter>.Default.Equals(Arg1, other.Arg1); 125EqualityComparer<TParameter1>.Default.Equals(Arg1, other.Arg1) 126&& EqualityComparer<TParameter2>.Default.Equals(Arg2, other.Arg2);
Microsoft.Interop.ComInterfaceGenerator (1)
Comparers.cs (1)
18public static readonly IEqualityComparer<(MemberDeclarationSyntax Syntax, ImmutableArray<DiagnosticInfo> Diagnostics)> GeneratedSyntax = new CustomValueTupleElementComparer<MemberDeclarationSyntax, ImmutableArray<DiagnosticInfo>>(SyntaxEquivalentComparer.Instance, new ImmutableArraySequenceEqualComparer<DiagnosticInfo>(EqualityComparer<DiagnosticInfo>.Default));
Microsoft.Interop.JavaScript.JSImportGenerator (2)
Comparers.cs (2)
18public static readonly IEqualityComparer<(MemberDeclarationSyntax Syntax, ImmutableArray<DiagnosticInfo> Diagnostics)> GeneratedSyntax = new CustomValueTupleElementComparer<MemberDeclarationSyntax, ImmutableArray<DiagnosticInfo>>(SyntaxEquivalentComparer.Instance, new ImmutableArraySequenceEqualComparer<DiagnosticInfo>(EqualityComparer<DiagnosticInfo>.Default)); 22new ImmutableArraySequenceEqualComparer<DiagnosticInfo>(EqualityComparer<DiagnosticInfo>.Default));
Microsoft.Interop.LibraryImportGenerator (1)
Comparers.cs (1)
18public static readonly IEqualityComparer<(MemberDeclarationSyntax Syntax, ImmutableArray<DiagnosticInfo> Diagnostics)> GeneratedSyntax = new CustomValueTupleElementComparer<MemberDeclarationSyntax, ImmutableArray<DiagnosticInfo>>(SyntaxEquivalentComparer.Instance, new ImmutableArraySequenceEqualComparer<DiagnosticInfo>(EqualityComparer<DiagnosticInfo>.Default));
Microsoft.Interop.LibraryImportGenerator.Downlevel (1)
Comparers.cs (1)
18public static readonly IEqualityComparer<(MemberDeclarationSyntax Syntax, ImmutableArray<DiagnosticInfo> Diagnostics)> GeneratedSyntax = new CustomValueTupleElementComparer<MemberDeclarationSyntax, ImmutableArray<DiagnosticInfo>>(SyntaxEquivalentComparer.Instance, new ImmutableArraySequenceEqualComparer<DiagnosticInfo>(EqualityComparer<DiagnosticInfo>.Default));
Microsoft.Interop.SourceGeneration (1)
SequenceEqualImmutableArray.cs (1)
21: this(array, EqualityComparer<T>.Default)
Microsoft.ML.Data (3)
Data\RowCursorUtils.cs (2)
319var compare = EqualityComparer<T>.Default;
Transforms\Hashing.cs (1)
1589return EqualityComparer<T>.Default;
Microsoft.ML.TestFramework (4)
BaseTestBaseline.cs (1)
447equalFunc = EqualityComparer<T>.Default.Equals;
DataPipe\TestDataPipe.cs (3)
503if (EqualityComparer<TDst>.Default.Equals(dst, v)) 507if (EqualityComparer<TDst>.Default.Equals(dst, default(TDst)) && !EqualityComparer<TSrc>.Default.Equals(src, vSrc))
Microsoft.ML.Transforms (1)
Text\NgramHashingTransformer.cs (1)
819stringMapper, EqualityComparer<NGram>.Default, (in NGram src, ref NGram dst) => dst = src.Clone());
Microsoft.VisualStudio.LanguageServices (5)
LanguageService\AbstractCreateServicesOnTextViewConnection.cs (1)
55EqualityComparer<ProjectId?>.Default,
Packaging\PackageInstallerServiceFactory.cs (1)
133equalityComparer: EqualityComparer<(bool solutionChanged, ProjectId? changedProject)>.Default,
Utilities\AbstractNotifyPropertyChanged.cs (1)
22if (!EqualityComparer<T>.Default.Equals(field, value))
Utilities\ViewModelBase.cs (1)
17if (EqualityComparer<T>.Default.Equals(field, value))
ValueTracking\ValueTrackingTreeViewModel.cs (1)
124if (EqualityComparer<T>.Default.Equals(field, value))
MSBuildTaskHost (1)
Concurrent\ConcurrentDictionary.cs (1)
121_comparer = comparer ?? EqualityComparer<TKey>.Default;
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
89[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.EqualityComparer<>))]
netstandard (1)
netstandard.cs (1)
108[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.EqualityComparer<>))]
PresentationFramework (1)
MS\Internal\WindowsRuntime\Generated\WinRT\Projections\IReadOnlyList.cs (1)
158if (EqualityComparer<T>.Default.Equals(value, _list[i]))
Shared (3)
Memoization\MemoizedFunction.cs (3)
53public bool Equals(MemoizedFunction<TParameter, TResult>.Arg other) => EqualityComparer<TParameter>.Default.Equals(Arg1, other.Arg1); 125EqualityComparer<TParameter1>.Default.Equals(Arg1, other.Arg1) 126&& EqualityComparer<TParameter2>.Default.Equals(Arg2, other.Arg2);
System.Collections (34)
artifacts\obj\System.Collections\Debug\net10.0\System.Collections.Forwards.cs (1)
6[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Collections.Generic.EqualityComparer<>))]
System\Collections\Generic\LinkedList.cs (4)
224EqualityComparer<T> c = EqualityComparer<T>.Default; 259EqualityComparer<T> c = EqualityComparer<T>.Default;
System\Collections\Generic\OrderedDictionary.cs (18)
85/// or null to use the default <see cref="EqualityComparer{TKey}"/> for the type of the key. 98/// or null to use the default <see cref="EqualityComparer{TKey}"/> for the type of the key. 123_comparer = comparer ?? EqualityComparer<TKey>.Default; 134comparer != EqualityComparer<TKey>.Default) 163/// or null to use the default <see cref="EqualityComparer{TKey}"/> for the type of the key. 197/// or null to use the default <see cref="EqualityComparer{TKey}"/> for the type of the key. 238return comparer ?? EqualityComparer<TKey>.Default; 569if (EqualityComparer<TValue>.Default.Equals(value, entries[i].Value)) 577EqualityComparer<TValue> comparer = EqualityComparer<TValue>.Default; 656if (entry.HashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entry.Key, key)) 826if (EqualityComparer<TKey>.Default.Equals(key, e.Key)) 1175if (EqualityComparer<TValue>.Default.Equals(item.Value, _entries[index].Value)) 1197EqualityComparer<TValue>.Default.Equals(value, item.Value); 1220EqualityComparer<TValue>.Default.Equals(value, item.Value) && 1338EqualityComparer<TValue>.Default.Equals(v, pair.Value); 1748if (EqualityComparer<TValue>.Default.Equals(item, entries[i].Value)) 1807if (EqualityComparer<TValue>.Default.Equals(tvalue, entries[i].Value))
System\Collections\Generic\PriorityQueue.cs (4)
512/// If no <paramref name="equalityComparer"/> is specified, <see cref="EqualityComparer{TElement}.Default"/> will be used instead. 879equalityComparer ??= EqualityComparer<TElement>.Default; 885if (typeof(TElement).IsValueType && equalityComparer == EqualityComparer<TElement>.Default) 889if (EqualityComparer<TElement>.Default.Equals(element, nodes[i].Element))
System\Collections\Generic\SortedDictionary.cs (4)
78return EqualityComparer<TValue>.Default.Equals(node.Item.Value, keyValuePair.Value); 90if (EqualityComparer<TValue>.Default.Equals(node.Item.Value, keyValuePair.Value)) 225EqualityComparer<TValue> valueComparer = EqualityComparer<TValue>.Default;
System\Collections\Generic\SortedList.cs (2)
197if (index >= 0 && EqualityComparer<TValue>.Default.Equals(values[index], keyValuePair.Value)) 207if (index >= 0 && EqualityComparer<TValue>.Default.Equals(values[index], keyValuePair.Value))
System\Collections\Generic\SortedSetEqualityComparer.cs (1)
27_memberEqualityComparer = memberEqualityComparer ?? EqualityComparer<T>.Default;
System.Collections.Concurrent (12)
System\Collections\Concurrent\ConcurrentDictionary.cs (12)
203ReferenceEquals(comparer, EqualityComparer<TKey>.Default)) 210comparer ??= EqualityComparer<TKey>.Default; 220else if (ReferenceEquals(comparer, EqualityComparer<TKey>.Default)) 326EqualityComparer<TKey>.Default.Equals(node._key, key) : 476bool valuesMatch = EqualityComparer<TValue>.Default.Equals(oldValue, curr._value); 533if (hashcode == n._hashcode && EqualityComparer<TKey>.Default.Equals(n._key, key)) 567if (hashcode == n._hashcode && EqualityComparer<TKey>.Default.Equals(n._key, key)) 640EqualityComparer<TValue> valueComparer = EqualityComparer<TValue>.Default; 1130/// if you do not specify one, the default generic equality comparer <see cref="EqualityComparer{TKey}.Default" /> is used. 1146return comparer ?? EqualityComparer<TKey>.Default; 1640EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value);
System.Collections.Immutable (129)
System\Collections\Frozen\FrozenDictionary.cs (6)
21/// <param name="comparer">The comparer implementation to use to compare keys for equality. If null, <see cref="EqualityComparer{TKey}.Default"/> is used.</param> 76comparer ??= EqualityComparer<TKey>.Default; 123if (typeof(TKey).IsValueType && ReferenceEquals(comparer, EqualityComparer<TKey>.Default)) 154(ReferenceEquals(comparer, EqualityComparer<TKey>.Default) || ReferenceEquals(comparer, StringComparer.Ordinal) || ReferenceEquals(comparer, StringComparer.OrdinalIgnoreCase))) 265public static FrozenDictionary<TKey, TValue> Empty { get; } = new EmptyFrozenDictionary<TKey, TValue>(EqualityComparer<TKey>.Default); 524EqualityComparer<TValue>.Default.Equals(value, item.Value);
System\Collections\Frozen\FrozenSet.cs (6)
26/// <param name="equalityComparer">The comparer implementation to use to compare values for equality. If null, <see cref="EqualityComparer{T}.Default"/> is used.</param> 54/// <param name="comparer">The comparer implementation to use to compare values for equality. If null, <see cref="EqualityComparer{T}.Default"/> is used.</param> 65comparer ??= EqualityComparer<T>.Default; 104if (typeof(T).IsValueType && ReferenceEquals(comparer, EqualityComparer<T>.Default)) 136(ReferenceEquals(comparer, EqualityComparer<T>.Default) || ReferenceEquals(comparer, StringComparer.Ordinal) || ReferenceEquals(comparer, StringComparer.OrdinalIgnoreCase))) 251public static FrozenSet<T> Empty { get; } = new EmptyFrozenSet<T>(EqualityComparer<T>.Default);
System\Collections\Frozen\Int32\Int32FrozenDictionary.cs (2)
21internal Int32FrozenDictionary(Dictionary<int, TValue> source) : base(EqualityComparer<int>.Default) 23Debug.Assert(ReferenceEquals(source.Comparer, EqualityComparer<int>.Default));
System\Collections\Frozen\Int32\Int32FrozenSet.cs (2)
19internal Int32FrozenSet(HashSet<int> source) : base(EqualityComparer<int>.Default) 22Debug.Assert(ReferenceEquals(source.Comparer, EqualityComparer<int>.Default));
System\Collections\Frozen\SmallValueTypeComparableFrozenDictionary.cs (2)
25internal SmallValueTypeComparableFrozenDictionary(Dictionary<TKey, TValue> source) : base(EqualityComparer<TKey>.Default) 32Debug.Assert(ReferenceEquals(source.Comparer, EqualityComparer<TKey>.Default));
System\Collections\Frozen\SmallValueTypeComparableFrozenSet.cs (2)
23internal SmallValueTypeComparableFrozenSet(HashSet<T> source) : base(EqualityComparer<T>.Default) 30Debug.Assert(ReferenceEquals(source.Comparer, EqualityComparer<T>.Default));
System\Collections\Frozen\SmallValueTypeDefaultComparerFrozenDictionary.cs (3)
18internal SmallValueTypeDefaultComparerFrozenDictionary(Dictionary<TKey, TValue> source) : base(EqualityComparer<TKey>.Default) 24Debug.Assert(ReferenceEquals(source.Comparer, EqualityComparer<TKey>.Default)); 41if (EqualityComparer<TKey>.Default.Equals(keys[i], key))
System\Collections\Frozen\SmallValueTypeDefaultComparerFrozenSet.cs (3)
16internal SmallValueTypeDefaultComparerFrozenSet(HashSet<T> source) : base(EqualityComparer<T>.Default) 22Debug.Assert(ReferenceEquals(source.Comparer, EqualityComparer<T>.Default)); 36if (EqualityComparer<T>.Default.Equals(item, items[i]))
System\Collections\Frozen\String\LengthBuckets.cs (1)
19Debug.Assert(comparer == EqualityComparer<string>.Default || comparer == StringComparer.Ordinal || comparer == StringComparer.OrdinalIgnoreCase);
System\Collections\Frozen\String\LengthBucketsFrozenDictionary.cs (1)
23Debug.Assert(comparer == EqualityComparer<string>.Default || comparer == StringComparer.Ordinal || comparer == StringComparer.OrdinalIgnoreCase);
System\Collections\Frozen\String\LengthBucketsFrozenSet.cs (1)
21Debug.Assert(comparer == EqualityComparer<string>.Default || comparer == StringComparer.Ordinal || comparer == StringComparer.OrdinalIgnoreCase);
System\Collections\Frozen\String\OrdinalStringFrozenDictionary.cs (1)
31Debug.Assert(comparer == EqualityComparer<string>.Default || comparer == StringComparer.Ordinal || comparer == StringComparer.OrdinalIgnoreCase);
System\Collections\Frozen\ValueTypeDefaultComparerFrozenDictionary.cs (3)
19Debug.Assert(ReferenceEquals(source.Comparer, EqualityComparer<TKey>.Default)); 25int hashCode = EqualityComparer<TKey>.Default.GetHashCode(key); 32if (EqualityComparer<TKey>.Default.Equals(key, _keys[index]))
System\Collections\Frozen\ValueTypeDefaultComparerFrozenSet.cs (3)
16Debug.Assert(ReferenceEquals(source.Comparer, EqualityComparer<T>.Default)); 22int hashCode = EqualityComparer<T>.Default.GetHashCode(item!); 29if (EqualityComparer<T>.Default.Equals(item, _items[index]))
System\Collections\Immutable\IImmutableList.cs (5)
43/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 66/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 111/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 135/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 174/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used.
System\Collections\Immutable\ImmutableArray_1.Builder.cs (17)
517/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 611this.RemoveRange(items, EqualityComparer<T>.Default); 620/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 646this.Replace(oldValue, newValue, EqualityComparer<T>.Default); 656/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 755return this.IndexOf(item, 0, _count, EqualityComparer<T>.Default); 766return this.IndexOf(item, startIndex, this.Count - startIndex, EqualityComparer<T>.Default); 778return this.IndexOf(item, startIndex, count, EqualityComparer<T>.Default); 789/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 802equalityComparer ??= EqualityComparer<T>.Default; 803if (equalityComparer == EqualityComparer<T>.Default) 828/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 848return this.LastIndexOf(item, this.Count - 1, this.Count, EqualityComparer<T>.Default); 866return this.LastIndexOf(item, startIndex, startIndex + 1, EqualityComparer<T>.Default); 878return this.LastIndexOf(item, startIndex, count, EqualityComparer<T>.Default); 899equalityComparer ??= EqualityComparer<T>.Default; 900if (equalityComparer == EqualityComparer<T>.Default)
System\Collections\Immutable\ImmutableArray_1.cs (19)
115return self.IndexOf(item, 0, self.Length, EqualityComparer<T>.Default); 140return self.IndexOf(item, startIndex, self.Length - startIndex, EqualityComparer<T>.Default); 152return this.IndexOf(item, startIndex, count, EqualityComparer<T>.Default); 163/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 179equalityComparer ??= EqualityComparer<T>.Default; 180if (equalityComparer == EqualityComparer<T>.Default) 211return self.LastIndexOf(item, self.Length - 1, self.Length, EqualityComparer<T>.Default); 228return self.LastIndexOf(item, startIndex, startIndex + 1, EqualityComparer<T>.Default); 240return this.LastIndexOf(item, startIndex, count, EqualityComparer<T>.Default); 264equalityComparer ??= EqualityComparer<T>.Default; 265if (equalityComparer == EqualityComparer<T>.Default) 299/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 575return this.Replace(oldValue, newValue, EqualityComparer<T>.Default); 585/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 609return this.Remove(item, EqualityComparer<T>.Default); 619/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 675return this.RemoveRange(items, EqualityComparer<T>.Default); 684/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 717return this.RemoveRange(items, EqualityComparer<T>.Default);
System\Collections\Immutable\ImmutableDictionary_2.Comparers.cs (2)
26internal static readonly Comparers Default = new Comparers(EqualityComparer<TKey>.Default, EqualityComparer<TValue>.Default);
System\Collections\Immutable\ImmutableDictionary_2.cs (4)
67_comparers = comparers ?? Comparers.Get(EqualityComparer<TKey>.Default, EqualityComparer<TValue>.Default); 427keyComparer ??= EqualityComparer<TKey>.Default; 428valueComparer ??= EqualityComparer<TValue>.Default;
System\Collections\Immutable\ImmutableHashSet_1.cs (3)
27public static readonly ImmutableHashSet<T> Empty = new ImmutableHashSet<T>(SortedInt32KeyNode<HashBucket>.EmptyNode, EqualityComparer<T>.Default, 0); 418equalityComparer ??= EqualityComparer<T>.Default; 997else if (valueComparer == EqualityComparer<T>.Default)
System\Collections\Immutable\ImmutableHashSet_1.HashBucketByValueEqualityComparer.cs (3)
20/// The instance to use when the value comparer is <see cref="EqualityComparer{T}.Default"/>. 22private static readonly IEqualityComparer<HashBucket> s_defaultInstance = new HashBucketByValueEqualityComparer(EqualityComparer<T>.Default); 26/// <see cref="EqualityComparer{T}.Default"/>.
System\Collections\Immutable\ImmutableInterlocked.cs (2)
472EqualityComparer<TValue> valueComparer = EqualityComparer<TValue>.Default;
System\Collections\Immutable\ImmutableList.cs (9)
103return list.Replace(oldValue, newValue, EqualityComparer<T>.Default); 115return list.Remove(value, EqualityComparer<T>.Default); 129return list.RemoveRange(items, EqualityComparer<T>.Default); 149return list.IndexOf(item, 0, list.Count, EqualityComparer<T>.Default); 195return list.IndexOf(item, startIndex, list.Count - startIndex, EqualityComparer<T>.Default); 223return list.IndexOf(item, startIndex, count, EqualityComparer<T>.Default); 249return list.LastIndexOf(item, list.Count - 1, list.Count, EqualityComparer<T>.Default); 306return list.LastIndexOf(item, startIndex, startIndex + 1, EqualityComparer<T>.Default); 333return list.LastIndexOf(item, startIndex, count, EqualityComparer<T>.Default);
System\Collections\Immutable\ImmutableList_1.Builder.cs (12)
159return this.Root.IndexOf(item, EqualityComparer<T>.Default); 522_root.IndexOf(item, index, this.Count - index, EqualityComparer<T>.Default); 546_root.IndexOf(item, index, count, EqualityComparer<T>.Default); 566/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 598return _root.LastIndexOf(item, this.Count - 1, this.Count, EqualityComparer<T>.Default); 624return _root.LastIndexOf(item, startIndex, startIndex + 1, EqualityComparer<T>.Default); 645_root.LastIndexOf(item, startIndex, count, EqualityComparer<T>.Default); 748/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 786/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 808this.RemoveRange(items, EqualityComparer<T>.Default); 819this.Replace(oldValue, newValue, EqualityComparer<T>.Default); 829/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used.
System\Collections\Immutable\ImmutableList_1.cs (7)
279public ImmutableList<T> Remove(T value) => this.Remove(value, EqualityComparer<T>.Default); 318public ImmutableList<T> RemoveRange(IEnumerable<T> items) => this.RemoveRange(items, EqualityComparer<T>.Default); 326/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 392public ImmutableList<T> Replace(T oldValue, T newValue) => this.Replace(oldValue, newValue, EqualityComparer<T>.Default); 801public bool Contains(T value) => _root.Contains(value, EqualityComparer<T>.Default); 806public int IndexOf(T value) => this.IndexOf(value, EqualityComparer<T>.Default); 879/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used.
System\Collections\Immutable\ImmutableList_1.Node.cs (3)
753/// If <c>null</c>, <see cref="EqualityComparer{T}.Default"/> is used. 767equalityComparer ??= EqualityComparer<T>.Default; 808equalityComparer ??= EqualityComparer<T>.Default;
System\Collections\Immutable\ImmutableSortedDictionary_2.Builder.cs (1)
44private IEqualityComparer<TValue> _valueComparer = EqualityComparer<TValue>.Default;
System\Collections\Immutable\ImmutableSortedDictionary_2.cs (2)
54_valueComparer = valueComparer ?? EqualityComparer<TValue>.Default; 324valueComparer ??= EqualityComparer<TValue>.Default;
System\Linq\ImmutableArrayExtensions.cs (4)
170comparer ??= EqualityComparer<TBase>.Default; 192comparer ??= EqualityComparer<TBase>.Default; 547return ToDictionary(immutableArray, keySelector, EqualityComparer<TKey>.Default); 562return ToDictionary(immutableArray, keySelector, elementSelector, EqualityComparer<TKey>.Default);
System.Linq (16)
System\Linq\Contains.cs (1)
34if (EqualityComparer<TSource>.Default.Equals(element, value))
System\Linq\Distinct.cs (2)
37/// <para>The <see cref="DistinctBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey})" /> method returns an unordered sequence that contains no duplicate values. The default equality comparer, <see cref="EqualityComparer{T}.Default" />, is used to compare values.</para> 51/// <para>The <see cref="DistinctBy{TSource, TKey}(IEnumerable{TSource}, Func{TSource, TKey}, IEqualityComparer{TKey}?)" /> method returns an unordered sequence that contains no duplicate values. If <paramref name="comparer" /> is <see langword="null" />, the default equality comparer, <see cref="EqualityComparer{T}.Default" />, is used to compare values.</para>
System\Linq\Intersect.cs (2)
39/// <para>The default equality comparer, <see cref="EqualityComparer{T}.Default" />, is used to compare values.</para> 56/// <para>If <paramref name="comparer" /> is <see langword="null" />, the default equality comparer, <see cref="EqualityComparer{T}.Default" />, is used to compare values.</para>
System\Linq\Lookup.cs (1)
128_comparer = comparer ?? EqualityComparer<TKey>.Default;
System\Linq\Repeat.SpeedOpt.cs (1)
87return EqualityComparer<TResult>.Default.Equals(_current, item);
System\Linq\SequenceEqual.cs (2)
39comparer ??= EqualityComparer<TSource>.Default; 57comparer ??= EqualityComparer<TSource>.Default;
System\Linq\SkipTake.SpeedOpt.cs (1)
166if (EqualityComparer<TSource>.Default.Equals(source[i], item))
System\Linq\ToCollection.cs (2)
100/// If <paramref name="comparer"/> is null, the default equality comparer <see cref="EqualityComparer{TKey}.Default"/> is used to compare keys. 135/// If <paramref name="comparer"/> is null, the default equality comparer <see cref="EqualityComparer{TKey}.Default"/> is used to compare keys.
System\Linq\Union.cs (2)
39/// <para>The default equality comparer, <see cref="EqualityComparer{T}.Default" />, is used to compare values.</para> 55/// <para>If <paramref name="comparer" /> is <see langword="null" />, the default equality comparer, <see cref="EqualityComparer{T}.Default" />, is used to compare values.</para>
System\Linq\Utilities.cs (2)
27var defaultComparer = EqualityComparer<TSource>.Default;
System.Linq.Expressions (8)
System\Dynamic\Utils\CollectionExtensions.cs (4)
85EqualityComparer<T> cmp = EqualityComparer<T>.Default; 111EqualityComparer<T> cmp = EqualityComparer<T>.Default;
System\Dynamic\Utils\Helpers.cs (2)
14EqualityComparer<T> cmp = EqualityComparer<T>.Default;
System\Linq\Expressions\Interpreter\LabelInfo.cs (2)
221EqualityComparer<T> cmp = EqualityComparer<T>.Default;
System.Linq.Parallel (10)
System\Linq\Parallel\QueryOperators\Binary\UnionQueryOperator.cs (1)
324_comparer = comparer ?? EqualityComparer<TInputOutput>.Default;
System\Linq\Parallel\QueryOperators\Unary\ContainsSearchOperator.cs (1)
43_comparer = comparer ?? EqualityComparer<TInput>.Default;
System\Linq\Parallel\Utils\WrapperEqualityComparer.cs (1)
25_comparer = comparer ?? EqualityComparer<T>.Default;
System\Linq\ParallelEnumerable.cs (7)
4377comparer ??= EqualityComparer<TSource>.Default; 4932return ToDictionary(source, keySelector, EqualityComparer<TKey>.Default); 5023return ToDictionary(source, keySelector, elementSelector, EqualityComparer<TKey>.Default); 5115return ToLookup(source, keySelector, EqualityComparer<TKey>.Default); 5144comparer ??= EqualityComparer<TKey>.Default; 5194return ToLookup(source, keySelector, elementSelector, EqualityComparer<TKey>.Default); 5231comparer ??= EqualityComparer<TKey>.Default;
System.Numerics.Tensors (3)
System\Numerics\Tensors\netcore\TensorPrimitives.HammingDistance.cs (3)
180if (!EqualityComparer<T>.Default.Equals(x[i], y[i])) 188EqualityComparer<T> comparer = EqualityComparer<T>.Default;
System.ObjectModel (2)
System\Collections\ObjectModel\KeyedCollection.cs (2)
40this.comparer = comparer ?? EqualityComparer<TKey>.Default; 126return EqualityComparer<TItem>.Default.Equals(itemInDict, item);
System.Private.CoreLib (129)
src\libraries\System.Private.CoreLib\src\System\ArgumentOutOfRangeException.cs (2)
162if (EqualityComparer<T>.Default.Equals(value, other)) 172if (!EqualityComparer<T>.Default.Equals(value, other))
src\libraries\System.Private.CoreLib\src\System\Array.cs (2)
1547return EqualityComparer<T>.Default.IndexOf(array, value, startIndex, count); 1799return EqualityComparer<T>.Default.LastIndexOf(array, value, startIndex, count);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\Dictionary.cs (13)
67_comparer = comparer ?? EqualityComparer<TKey>.Default; 79comparer != EqualityComparer<TKey>.Default) 204return _comparer ?? EqualityComparer<TKey>.Default; 260if (!Unsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 271if (!Unsafe.IsNullRef(ref value) && EqualityComparer<TValue>.Default.Equals(value, keyValuePair.Value)) 318if (entries![i].next >= -1 && EqualityComparer<TValue>.Default.Equals(entries[i].value, value)) 329EqualityComparer<TValue> defaultComparer = EqualityComparer<TValue>.Default; 428if (entry.hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entry.key, key)) 538if (entries[i].hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entries[i].key, key)) 1103if (entries[i].hashCode == hashCode && EqualityComparer<TKey>.Default.Equals(entries[i].key, key)) 1320(typeof(TKey).IsValueType && comparer == null ? EqualityComparer<TKey>.Default.Equals(entry.key, key) : comparer!.Equals(entry.key, key))) 1393(typeof(TKey).IsValueType && comparer == null ? EqualityComparer<TKey>.Default.Equals(entry.key, key) : comparer!.Equals(entry.key, key)))
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\EqualityComparer.cs (8)
17/// Creates an <see cref="EqualityComparer{T}"/> by using the specified delegates as the implementation of the comparer's 18/// <see cref="EqualityComparer{T}.Equals"/> and <see cref="EqualityComparer{T}.GetHashCode"/> methods. 20/// <param name="equals">The delegate to use to implement the <see cref="EqualityComparer{T}.Equals"/> method.</param> 22/// The delegate to use to implement the <see cref="EqualityComparer{T}.GetHashCode"/> method. 23/// If no delegate is supplied, calls to the resulting comparer's <see cref="EqualityComparer{T}.GetHashCode"/> 28public static EqualityComparer<T> Create(Func<T?, T?, bool> equals, Func<T, int>? getHashCode = null) 164if (y.HasValue) return EqualityComparer<T>.Default.Equals(x.value, y.value);
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\HashSet.cs (7)
66_comparer = comparer ?? EqualityComparer<T>.Default; 78comparer != EqualityComparer<T>.Default) 239if (entry.HashCode == hashCode && EqualityComparer<T>.Default.Equals(entry.Value, item)) 316if (entry.HashCode == hashCode && (comparer?.Equals(entry.Value, item) ?? EqualityComparer<T>.Default.Equals(entry.Value, item))) 1250return _comparer ?? EqualityComparer<T>.Default; 1258internal IEqualityComparer<T> EffectiveComparer => _comparer ?? EqualityComparer<T>.Default; 1439if (entry.HashCode == hashCode && EqualityComparer<T>.Default.Equals(entry.Value, value))
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\HashSetEqualityComparer.cs (3)
25EqualityComparer<T> defaultComparer = EqualityComparer<T>.Default; 77public override int GetHashCode() => EqualityComparer<T>.Default.GetHashCode();
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\NonRandomizedStringEqualityComparer.cs (3)
23private static readonly NonRandomizedStringEqualityComparer WrappedAroundDefaultComparer = new OrdinalComparer(EqualityComparer<string?>.Default); 39: this(EqualityComparer<string?>.Default) 152if (ReferenceEquals(comparer, EqualityComparer<string>.Default))
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\RandomizedStringEqualityComparer.cs (1)
10/// A randomized <see cref="EqualityComparer{String}"/> which uses a different seed on each
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (6)
2170if (comparer is null || comparer == EqualityComparer<T>.Default) 2184if (!EqualityComparer<T>.Default.Equals(span[i], other[i])) 2195comparer ??= EqualityComparer<T>.Default; 3247if (!EqualityComparer<T>.Default.Equals(span[i], other[i])) 3266if (typeof(T).IsValueType && (comparer is null || comparer == EqualityComparer<T>.Default)) 3276comparer ??= EqualityComparer<T>.Default;
src\libraries\System.Private.CoreLib\src\System\Nullable.cs (1)
94if (n2.HasValue) return EqualityComparer<T>.Default.Equals(n1.value, n2.value);
src\libraries\System.Private.CoreLib\src\System\Numerics\TotalOrderIeee754Comparer.cs (1)
236public override int GetHashCode() => EqualityComparer<T>.Default.GetHashCode();
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.T.cs (21)
1063if (!EqualityComparer<T>.Default.Equals(Unsafe.Add(ref searchSpace, i), value0)) 1078if (!EqualityComparer<T>.Default.Equals(Unsafe.Add(ref searchSpace, i), value0)) 1094if (!EqualityComparer<T>.Default.Equals(current, value0) && !EqualityComparer<T>.Default.Equals(current, value1)) 1110if (!EqualityComparer<T>.Default.Equals(current, value0) && !EqualityComparer<T>.Default.Equals(current, value1)) 1126if (!EqualityComparer<T>.Default.Equals(current, value0) 1127&& !EqualityComparer<T>.Default.Equals(current, value1) 1128&& !EqualityComparer<T>.Default.Equals(current, value2)) 1144if (!EqualityComparer<T>.Default.Equals(current, value0) 1145&& !EqualityComparer<T>.Default.Equals(current, value1) 1146&& !EqualityComparer<T>.Default.Equals(current, value2)) 1162if (!EqualityComparer<T>.Default.Equals(current, value0) 1163&& !EqualityComparer<T>.Default.Equals(current, value1) 1164&& !EqualityComparer<T>.Default.Equals(current, value2) 1165&& !EqualityComparer<T>.Default.Equals(current, value3)) 1181if (!EqualityComparer<T>.Default.Equals(current, value0) 1182&& !EqualityComparer<T>.Default.Equals(current, value1) 1183&& !EqualityComparer<T>.Default.Equals(current, value2) 1184&& !EqualityComparer<T>.Default.Equals(current, value3)) 3087Unsafe.Add(ref dst, idx) = EqualityComparer<T>.Default.Equals(original, oldValue) ? newValue : original;
src\libraries\System.Private.CoreLib\src\System\StringComparer.cs (2)
73/// For example, <see cref="EqualityComparer{String}.Default"/> is a well-known ordinal comparer because 74/// a <see cref="Dictionary{String, TValue}"/> given <see cref="EqualityComparer{String}.Default"/> as a constructor
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\ValueTask.cs (1)
555EqualityComparer<TResult>.Default.Equals(_result, other._result);
src\libraries\System.Private.CoreLib\src\System\Tuple.cs (16)
118return Equals(obj, EqualityComparer<object>.Default); 162return GetHashCode(EqualityComparer<object>.Default); 238return Equals(obj, EqualityComparer<object>.Default); 286return GetHashCode(EqualityComparer<object>.Default); 363return Equals(obj, EqualityComparer<object>.Default); 415return GetHashCode(EqualityComparer<object>.Default); 498return Equals(obj, EqualityComparer<object>.Default); 554return GetHashCode(EqualityComparer<object>.Default); 643return Equals(obj, EqualityComparer<object>.Default); 703return GetHashCode(EqualityComparer<object>.Default); 798return Equals(obj, EqualityComparer<object>.Default); 862return GetHashCode(EqualityComparer<object>.Default); 963return Equals(obj, EqualityComparer<object>.Default); 1031return GetHashCode(EqualityComparer<object>.Default); 1143return Equals(obj, EqualityComparer<object>.Default); 1215return GetHashCode(EqualityComparer<object>.Default);
src\libraries\System.Private.CoreLib\src\System\ValueTuple.cs (36)
310return EqualityComparer<T1>.Default.Equals(Item1, other.Item1); 481return EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 482&& EqualityComparer<T2>.Default.Equals(Item2, other.Item2); 688return EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 689&& EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 690&& EqualityComparer<T3>.Default.Equals(Item3, other.Item3); 893return EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 894&& EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 895&& EqualityComparer<T3>.Default.Equals(Item3, other.Item3) 896&& EqualityComparer<T4>.Default.Equals(Item4, other.Item4); 1116return EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 1117&& EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 1118&& EqualityComparer<T3>.Default.Equals(Item3, other.Item3) 1119&& EqualityComparer<T4>.Default.Equals(Item4, other.Item4) 1120&& EqualityComparer<T5>.Default.Equals(Item5, other.Item5); 1357return EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 1358&& EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 1359&& EqualityComparer<T3>.Default.Equals(Item3, other.Item3) 1360&& EqualityComparer<T4>.Default.Equals(Item4, other.Item4) 1361&& EqualityComparer<T5>.Default.Equals(Item5, other.Item5) 1362&& EqualityComparer<T6>.Default.Equals(Item6, other.Item6); 1616return EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 1617&& EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 1618&& EqualityComparer<T3>.Default.Equals(Item3, other.Item3) 1619&& EqualityComparer<T4>.Default.Equals(Item4, other.Item4) 1620&& EqualityComparer<T5>.Default.Equals(Item5, other.Item5) 1621&& EqualityComparer<T6>.Default.Equals(Item6, other.Item6) 1622&& EqualityComparer<T7>.Default.Equals(Item7, other.Item7); 1899return EqualityComparer<T1>.Default.Equals(Item1, other.Item1) 1900&& EqualityComparer<T2>.Default.Equals(Item2, other.Item2) 1901&& EqualityComparer<T3>.Default.Equals(Item3, other.Item3) 1902&& EqualityComparer<T4>.Default.Equals(Item4, other.Item4) 1903&& EqualityComparer<T5>.Default.Equals(Item5, other.Item5) 1904&& EqualityComparer<T6>.Default.Equals(Item6, other.Item6) 1905&& EqualityComparer<T7>.Default.Equals(Item7, other.Item7) 1906&& EqualityComparer<TRest>.Default.Equals(Rest, other.Rest);
src\System\Collections\Generic\ComparerHelpers.cs (2)
10/// Helper class for creating the default <see cref="Comparer{T}"/> and <see cref="EqualityComparer{T}"/>. 56/// Creates the default <see cref="EqualityComparer{T}"/>.
src\System\Collections\Generic\EqualityComparer.CoreCLR.cs (4)
13public static EqualityComparer<T> Default { [Intrinsic] get; } = (EqualityComparer<T>)ComparerHelpers.CreateDefaultEqualityComparer(typeof(T)); 75if (array[i].HasValue && EqualityComparer<T>.Default.Equals(array[i].value, value.value)) return i; 95if (array[i].HasValue && EqualityComparer<T>.Default.Equals(array[i].value, value.value)) return i;
System.ServiceModel.Primitives (4)
System\IdentityModel\Claims\Claim.cs (1)
87return EqualityComparer<Claim>.Default;
System\ServiceModel\SynchronizedKeyedCollection.cs (3)
24_comparer = EqualityComparer<K>.Default; 31_comparer = EqualityComparer<K>.Default; 195return EqualityComparer<T>.Default.Equals(item, itemInDict);
System.Text.Json (4)
src\libraries\System.Text.Json\Common\JsonHelpers.cs (1)
94comparer ??= EqualityComparer<T>.Default;
System\Text\Json\Nodes\JsonValueOfTPrimitive.cs (1)
36return EqualityComparer<TValue>.Default.Equals(Value, v);
System\Text\Json\Serialization\Metadata\JsonPropertyInfoOfT.cs (2)
449return default(T) is null ? value is not null : !EqualityComparer<T>.Default.Equals(default, value); 455return default(T) is null ? value is null : EqualityComparer<T>.Default.Equals(default, value);
System.Text.Json.SourceGeneration (1)
src\libraries\System.Text.Json\Common\JsonHelpers.cs (1)
94comparer ??= EqualityComparer<T>.Default;
System.Text.RegularExpressions (4)
System\Text\RegularExpressions\CaptureCollection.cs (1)
118if (EqualityComparer<Capture>.Default.Equals(this[i], item))
System\Text\RegularExpressions\GroupCollection.cs (1)
132if (EqualityComparer<Group>.Default.Equals(this[i], item))
System\Text\RegularExpressions\Symbolic\SymbolicRegexBuilder.cs (2)
96EqualityComparer<TSet>.Default.Equals(Set, other.Set) && 97EqualityComparer<SymbolicRegexInfo>.Default.Equals(Info, other.Info);
System.Windows.Forms.Primitives.TestUtilities (4)
Extensions\AssertExtensions.cs (4)
514EqualityComparer<T> comparer = EqualityComparer<T>.Default; 531EqualityComparer<T> comparer = EqualityComparer<T>.Default;
System.Xaml (21)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Utility\FrugalList.cs (21)
266return EqualityComparer<T>.Default.Equals(_loneEntry, value); 271if (EqualityComparer<T>.Default.Equals(_loneEntry, value)) 299if (EqualityComparer<T>.Default.Equals(_loneEntry, value)) 432if (EqualityComparer<T>.Default.Equals(_entry0, value)) 438if (EqualityComparer<T>.Default.Equals(_entry1, value)) 442if ((3 == _count) && EqualityComparer<T>.Default.Equals(_entry2, value)) 508if (EqualityComparer<T>.Default.Equals(_entry0, value)) 515if (EqualityComparer<T>.Default.Equals(_entry1, value)) 520else if ((3 == _count) && EqualityComparer<T>.Default.Equals(_entry2, value)) 769if (EqualityComparer<T>.Default.Equals(_entry0, value)) 775if (EqualityComparer<T>.Default.Equals(_entry1, value)) 781if (EqualityComparer<T>.Default.Equals(_entry2, value)) 787if (EqualityComparer<T>.Default.Equals(_entry3, value)) 793if (EqualityComparer<T>.Default.Equals(_entry4, value)) 797if ((6 == _count) && EqualityComparer<T>.Default.Equals(_entry5, value)) 902if (EqualityComparer<T>.Default.Equals(_entry0, value)) 909if (EqualityComparer<T>.Default.Equals(_entry1, value)) 916if (EqualityComparer<T>.Default.Equals(_entry2, value)) 923if (EqualityComparer<T>.Default.Equals(_entry3, value)) 930if (EqualityComparer<T>.Default.Equals(_entry4, value)) 935else if ((6 == _count) && EqualityComparer<T>.Default.Equals(_entry5, value))
Templates.Blazor.Tests (2)
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (2)
424EqualityComparer<string>.Default.Equals(x?.Thumbprint, y?.Thumbprint); 428EqualityComparer<string>.Default.GetHashCode(obj.Thumbprint);
Templates.Blazor.WebAssembly.Auth.Tests (2)
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (2)
424EqualityComparer<string>.Default.Equals(x?.Thumbprint, y?.Thumbprint); 428EqualityComparer<string>.Default.GetHashCode(obj.Thumbprint);
Templates.Blazor.WebAssembly.Tests (2)
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (2)
424EqualityComparer<string>.Default.Equals(x?.Thumbprint, y?.Thumbprint); 428EqualityComparer<string>.Default.GetHashCode(obj.Thumbprint);
Templates.Mvc.Tests (2)
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (2)
424EqualityComparer<string>.Default.Equals(x?.Thumbprint, y?.Thumbprint); 428EqualityComparer<string>.Default.GetHashCode(obj.Thumbprint);
Templates.Tests (2)
src\Shared\CertificateGeneration\MacOSCertificateManager.cs (2)
424EqualityComparer<string>.Default.Equals(x?.Thumbprint, y?.Thumbprint); 428EqualityComparer<string>.Default.GetHashCode(obj.Thumbprint);
xunit.assert (8)
AsyncCollectionAsserts.cs (1)
150 Distinct(AssertHelper.ToEnumerable(collection), EqualityComparer<T>.Default);
CollectionAsserts.cs (1)
316 Distinct<T>(collection, EqualityComparer<T>.Default);
EqualityAsserts.cs (6)
187 else if (comparer == EqualityComparer<T>.Default) 188 itemComparer = EqualityComparer<object>.Default; 715 else if (comparer == EqualityComparer<T>.Default) 716 itemComparer = EqualityComparer<object>.Default; 1001 if (!EqualityComparer<T>.Default.Equals(expected, actual)) 1030 if (EqualityComparer<T>.Default.Equals(expected, actual))