7 instantiations of ImmutableSegmentedHashSet
Microsoft.CodeAnalysis (7)
ImmutableSegmentedHashSet`1.cs (3)
16public static readonly ImmutableSegmentedHashSet<T> Empty = new(new SegmentedHashSet<T>()); 62return new ImmutableSegmentedHashSet<T>(set); 263return new ImmutableSegmentedHashSet<T>(new SegmentedHashSet<T>(self._set, equalityComparer));
ImmutableSegmentedHashSet`1+Builder.cs (1)
259_set = new ImmutableSegmentedHashSet<T>(ReadOnlySet);
ImmutableSegmentedHashSet`1+PrivateInterlocked.cs (3)
23return new ImmutableSegmentedHashSet<T>(set); 32return new ImmutableSegmentedHashSet<T>(set); 41return new ImmutableSegmentedHashSet<T>(set);
146 references to ImmutableSegmentedHashSet
Microsoft.CodeAnalysis (103)
ImmutableSegmentedHashSet.cs (30)
14public static ImmutableSegmentedHashSet<T> Create<T>() 15=> ImmutableSegmentedHashSet<T>.Empty; 18public static ImmutableSegmentedHashSet<T> Create<T>(T item) 19=> ImmutableSegmentedHashSet<T>.Empty.Add(item); 22public static ImmutableSegmentedHashSet<T> Create<T>(params T[] items) 23=> ImmutableSegmentedHashSet<T>.Empty.Union(items); 26public static ImmutableSegmentedHashSet<T> Create<T>(IEqualityComparer<T>? equalityComparer) 27=> ImmutableSegmentedHashSet<T>.Empty.WithComparer(equalityComparer); 30public static ImmutableSegmentedHashSet<T> Create<T>(IEqualityComparer<T>? equalityComparer, T item) 31=> ImmutableSegmentedHashSet<T>.Empty.WithComparer(equalityComparer).Add(item); 34public static ImmutableSegmentedHashSet<T> Create<T>(IEqualityComparer<T>? equalityComparer, params T[] items) 35=> ImmutableSegmentedHashSet<T>.Empty.WithComparer(equalityComparer).Union(items); 38public static ImmutableSegmentedHashSet<T>.Builder CreateBuilder<T>() 39=> ImmutableSegmentedHashSet<T>.Empty.ToBuilder(); 42public static ImmutableSegmentedHashSet<T>.Builder CreateBuilder<T>(IEqualityComparer<T>? equalityComparer) 43=> ImmutableSegmentedHashSet<T>.Empty.WithComparer(equalityComparer).ToBuilder(); 46public static ImmutableSegmentedHashSet<T> CreateRange<T>(IEnumerable<T> items) 48if (items is ImmutableSegmentedHashSet<T> existingSet) 51return ImmutableSegmentedHashSet<T>.Empty.Union(items); 55public static ImmutableSegmentedHashSet<T> CreateRange<T>(IEqualityComparer<T>? equalityComparer, IEnumerable<T> items) 57if (items is ImmutableSegmentedHashSet<T> existingSet) 60return ImmutableSegmentedHashSet<T>.Empty.WithComparer(equalityComparer).Union(items); 64public static ImmutableSegmentedHashSet<TSource> ToImmutableSegmentedHashSet<TSource>(this IEnumerable<TSource> source) 66if (source is ImmutableSegmentedHashSet<TSource> existingSet) 69return ImmutableSegmentedHashSet<TSource>.Empty.Union(source); 73public static ImmutableSegmentedHashSet<TSource> ToImmutableSegmentedHashSet<TSource>(this IEnumerable<TSource> source, IEqualityComparer<TSource>? equalityComparer) 75if (source is ImmutableSegmentedHashSet<TSource> existingSet) 78return ImmutableSegmentedHashSet<TSource>.Empty.WithComparer(equalityComparer).Union(source); 82public static ImmutableSegmentedHashSet<TSource> ToImmutableSegmentedHashSet<TSource>(this ImmutableSegmentedHashSet<TSource>.Builder builder)
ImmutableSegmentedHashSet`1.cs (32)
13internal readonly partial struct ImmutableSegmentedHashSet<T> : IImmutableSet<T>, ISet<T>, ICollection, IEquatable<ImmutableSegmentedHashSet<T>> 16public static readonly ImmutableSegmentedHashSet<T> Empty = new(new SegmentedHashSet<T>()); 42public static bool operator ==(ImmutableSegmentedHashSet<T> left, ImmutableSegmentedHashSet<T> right) 45public static bool operator !=(ImmutableSegmentedHashSet<T> left, ImmutableSegmentedHashSet<T> right) 48public static bool operator ==(ImmutableSegmentedHashSet<T>? left, ImmutableSegmentedHashSet<T>? right) 51public static bool operator !=(ImmutableSegmentedHashSet<T>? left, ImmutableSegmentedHashSet<T>? right) 55public ImmutableSegmentedHashSet<T> Add(T value) 57var self = this; 79public ImmutableSegmentedHashSet<T> Clear() 81var self = this; 96public ImmutableSegmentedHashSet<T> Except(IEnumerable<T> other) 98var self = this; 100if (other is ImmutableSegmentedHashSet<T> { IsEmpty: true }) 129public ImmutableSegmentedHashSet<T> Intersect(IEnumerable<T> other) 131var self = this; 133if (self.IsEmpty || other is ImmutableSegmentedHashSet<T> { IsEmpty: true }) 168public ImmutableSegmentedHashSet<T> Remove(T value) 170var self = this; 191public ImmutableSegmentedHashSet<T> SymmetricExcept(IEnumerable<T> other) 193var self = this; 195if (other is ImmutableSegmentedHashSet<T> otherSet) 231public ImmutableSegmentedHashSet<T> Union(IEnumerable<T> other) 233var self = this; 235if (other is ImmutableSegmentedHashSet<T> otherSet) 255public ImmutableSegmentedHashSet<T> WithComparer(IEqualityComparer<T>? equalityComparer) 257var self = this; 270=> obj is ImmutableSegmentedHashSet<T> other && Equals(other); 272public bool Equals(ImmutableSegmentedHashSet<T> other)
ImmutableSegmentedHashSet`1+Builder.cs (6)
20private ImmutableSegmentedHashSet<T> _set; 28internal Builder(ImmutableSegmentedHashSet<T> set) 63var originalSet = RoslynImmutableInterlocked.InterlockedExchange(ref _set, default); 120else if (other is ImmutableSegmentedHashSet<T> otherSet) 230if (other is ImmutableSegmentedHashSet<T> { IsEmpty: true }) 257public ImmutableSegmentedHashSet<T> ToImmutable()
ImmutableSegmentedHashSet`1+PrivateInterlocked.cs (9)
17internal static ImmutableSegmentedHashSet<T> VolatileRead(in ImmutableSegmentedHashSet<T> location) 26internal static ImmutableSegmentedHashSet<T> InterlockedExchange(ref ImmutableSegmentedHashSet<T> location, ImmutableSegmentedHashSet<T> value) 35internal static ImmutableSegmentedHashSet<T> InterlockedCompareExchange(ref ImmutableSegmentedHashSet<T> location, ImmutableSegmentedHashSet<T> value, ImmutableSegmentedHashSet<T> comparand)
RoslynImmutableInterlocked.cs (26)
151public static bool Update<T>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, ImmutableSegmentedHashSet<T>> transformer) 156var oldValue = ImmutableSegmentedHashSet<T>.PrivateInterlocked.VolatileRead(in location); 159var newValue = transformer(oldValue); 166var interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue); 192public static bool Update<T, TArg>(ref ImmutableSegmentedHashSet<T> location, Func<ImmutableSegmentedHashSet<T>, TArg, ImmutableSegmentedHashSet<T>> transformer, TArg transformerArgument) 197var oldValue = ImmutableSegmentedHashSet<T>.PrivateInterlocked.VolatileRead(in location); 200var newValue = transformer(oldValue, transformerArgument); 207var interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue); 223public static ImmutableSegmentedHashSet<T> InterlockedExchange<T>(ref ImmutableSegmentedHashSet<T> location, ImmutableSegmentedHashSet<T> value) 225return ImmutableSegmentedHashSet<T>.PrivateInterlocked.InterlockedExchange(ref location, value); 237public static ImmutableSegmentedHashSet<T> InterlockedCompareExchange<T>(ref ImmutableSegmentedHashSet<T> location, ImmutableSegmentedHashSet<T> value, ImmutableSegmentedHashSet<T> comparand) 239return ImmutableSegmentedHashSet<T>.PrivateInterlocked.InterlockedCompareExchange(ref location, value, comparand); 251public static bool InterlockedInitialize<T>(ref ImmutableSegmentedHashSet<T> location, ImmutableSegmentedHashSet<T> value) 253return InterlockedCompareExchange(ref location, value, default(ImmutableSegmentedHashSet<T>)).IsDefault;
Microsoft.CodeAnalysis.UnitTests (43)
Collections\ImmutableSegmentedHashSetBuilderTest.cs (16)
34var builder = ImmutableSegmentedHashSet<int>.Empty.ToBuilder(); 43var set = builder.ToImmutable(); 55var set = ImmutableSegmentedHashSet<int>.Empty.Add(1); 66var set2 = builder.ToImmutable(); 81var builder = ImmutableSegmentedHashSet<int>.Empty.Union(Enumerable.Range(1, 10)).ToBuilder(); 103var collection = ImmutableSegmentedHashSet<int>.Empty.Add(1); 108var newImmutable = builder.ToImmutable(); 123var set = ImmutableSegmentedHashSet.Create(1); 143var set = builder.ToImmutable(); 155var set = builder.ToImmutable(); 168var set = builder.ToImmutable(); 293var builder = ImmutableSegmentedHashSet<string?>.Empty.ToBuilder(); 321ImmutableSegmentedHashSet<int>.Builder builder = ImmutableSegmentedHashSet.CreateBuilder<int>(); 339ImmutableSegmentedHashSet<int>.Builder? nullBuilder = null;
Collections\ImmutableSegmentedHashSetTest.cs (21)
32ImmutableSegmentedHashSet<string>.Empty.WithComparer(StringComparer.Ordinal), 37ImmutableSegmentedHashSet<string>.Empty.WithComparer(StringComparer.OrdinalIgnoreCase), 46var ordinalSet = ImmutableSegmentedHashSet<string>.Empty 53var ignoreCaseSet = ordinalSet.WithComparer(StringComparer.OrdinalIgnoreCase); 61var set = ImmutableSegmentedHashSet<string>.Empty 71var emptySet = EmptyTyped<int>().WithComparer(new BadHasher<int>()); 78var emptySet = EmptyTyped<string>().WithComparer(new BadHasher<string>()); 85var collection = ImmutableSegmentedHashSet.Create<int>().Add(5); 114var set = ImmutableSegmentedHashSet.Create<string?>(); 161var set = ImmutableSegmentedHashSet.Create<int>(new BadHasher<int>(), 5, 6); 163var setAfterRemovingFive = set.Remove(5); 176var set = ImmutableSegmentedHashSet.Create<string>(new BadHasher<string>(), "a", "b"); 178var setAfterRemovingA = set.Remove("a"); 187ImmutableSegmentedHashSet<int> set = ImmutableSegmentedHashSet.Create(1, 2, 3); 205var set = ImmutableSegmentedHashSet.Create<string>("a").WithComparer(StringComparer.OrdinalIgnoreCase); 211var actualSet = set.SymmetricExcept(otherCollection); 217return ImmutableSegmentedHashSet<T>.Empty; 220private protected static ImmutableSegmentedHashSet<T> EmptyTyped<T>() 222return ImmutableSegmentedHashSet<T>.Empty;
Collections\ImmutableSegmentedHashSetTest.nonnetstandard.cs (2)
30TryGetValueTestHelper(ImmutableSegmentedHashSet<string>.Empty.WithComparer(StringComparer.OrdinalIgnoreCase)); 50Assert.True(IsSame(emptySet, ImmutableSegmentedHashSet<T>.Empty));
Collections\ImmutableSetTest.nonnetstandard.cs (2)
66ImmutableSegmentedHashSet<T> => null, 82ImmutableSegmentedHashSet<T> s => s.KeyComparer,
Collections\ImmutablesTestBase.cs (2)
75if (first is ImmutableSegmentedHashSet<T> firstSegmented 76&& second is ImmutableSegmentedHashSet<T> secondSegmented)