8 instantiations of ImmutableSegmentedHashSet
Microsoft.CodeAnalysis.Workspaces (8)
src\Dependencies\Collections\ImmutableSegmentedHashSet`1.cs (3)
67
public static readonly ImmutableSegmentedHashSet<T> Empty =
new
(new SegmentedHashSet<T>());
113
return new
ImmutableSegmentedHashSet
<T>(set);
311
return new
ImmutableSegmentedHashSet
<T>(new SegmentedHashSet<T>(self._set, equalityComparer));
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (4)
24
return new
ImmutableSegmentedHashSet
<T>(set);
33
return new
ImmutableSegmentedHashSet
<T>(set);
42
return new
ImmutableSegmentedHashSet
<T>(set);
47
=> set is not null ? new
ImmutableSegmentedHashSet
<T>(set) : default;
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+ValueBuilder.cs (1)
264
_set = new
ImmutableSegmentedHashSet
<T>(ReadOnlySet);
127 references to ImmutableSegmentedHashSet
Microsoft.CodeAnalysis.Workspaces (127)
src\Dependencies\Collections\ImmutableSegmentedHashSet.cs (30)
14
public static
ImmutableSegmentedHashSet
<T> Create<T>()
15
=>
ImmutableSegmentedHashSet
<T>.Empty;
18
public static
ImmutableSegmentedHashSet
<T> Create<T>(T item)
19
=>
ImmutableSegmentedHashSet
<T>.Empty.Add(item);
22
public static
ImmutableSegmentedHashSet
<T> Create<T>(params T[] items)
23
=>
ImmutableSegmentedHashSet
<T>.Empty.Union(items);
26
public static
ImmutableSegmentedHashSet
<T> Create<T>(IEqualityComparer<T>? equalityComparer)
27
=>
ImmutableSegmentedHashSet
<T>.Empty.WithComparer(equalityComparer);
30
public static
ImmutableSegmentedHashSet
<T> Create<T>(IEqualityComparer<T>? equalityComparer, T item)
31
=>
ImmutableSegmentedHashSet
<T>.Empty.WithComparer(equalityComparer).Add(item);
34
public static
ImmutableSegmentedHashSet
<T> Create<T>(IEqualityComparer<T>? equalityComparer, params T[] items)
35
=>
ImmutableSegmentedHashSet
<T>.Empty.WithComparer(equalityComparer).Union(items);
38
public static
ImmutableSegmentedHashSet
<T>.Builder CreateBuilder<T>()
39
=>
ImmutableSegmentedHashSet
<T>.Empty.ToBuilder();
42
public static
ImmutableSegmentedHashSet
<T>.Builder CreateBuilder<T>(IEqualityComparer<T>? equalityComparer)
43
=>
ImmutableSegmentedHashSet
<T>.Empty.WithComparer(equalityComparer).ToBuilder();
46
public static
ImmutableSegmentedHashSet
<T> CreateRange<T>(IEnumerable<T> items)
48
if (items is
ImmutableSegmentedHashSet
<T> existingSet)
51
return
ImmutableSegmentedHashSet
<T>.Empty.Union(items);
55
public static
ImmutableSegmentedHashSet
<T> CreateRange<T>(IEqualityComparer<T>? equalityComparer, IEnumerable<T> items)
57
if (items is
ImmutableSegmentedHashSet
<T> existingSet)
60
return
ImmutableSegmentedHashSet
<T>.Empty.WithComparer(equalityComparer).Union(items);
64
public static
ImmutableSegmentedHashSet
<TSource> ToImmutableSegmentedHashSet<TSource>(this IEnumerable<TSource> source)
66
if (source is
ImmutableSegmentedHashSet
<TSource> existingSet)
69
return
ImmutableSegmentedHashSet
<TSource>.Empty.Union(source);
73
public static
ImmutableSegmentedHashSet
<TSource> ToImmutableSegmentedHashSet<TSource>(this IEnumerable<TSource> source, IEqualityComparer<TSource>? equalityComparer)
75
if (source is
ImmutableSegmentedHashSet
<TSource> existingSet)
78
return
ImmutableSegmentedHashSet
<TSource>.Empty.WithComparer(equalityComparer).Union(source);
82
public static
ImmutableSegmentedHashSet
<TSource> ToImmutableSegmentedHashSet<TSource>(this
ImmutableSegmentedHashSet
<TSource>.Builder builder)
src\Dependencies\Collections\ImmutableSegmentedHashSet`1.cs (35)
17
/// <para>There are different scenarios best for <see cref="
ImmutableSegmentedHashSet
{T}"/> and others
21
/// <see cref="
ImmutableSegmentedHashSet
{T}"/>:</para>
26
/// <description><see cref="
ImmutableSegmentedHashSet
{T}"/> Complexity</description>
64
internal readonly partial struct ImmutableSegmentedHashSet<T> : IImmutableSet<T>, ISet<T>, ICollection, IEquatable<
ImmutableSegmentedHashSet
<T>>
67
public static readonly
ImmutableSegmentedHashSet
<T> Empty = new(new SegmentedHashSet<T>());
93
public static bool operator ==(
ImmutableSegmentedHashSet
<T> left,
ImmutableSegmentedHashSet
<T> right)
96
public static bool operator !=(
ImmutableSegmentedHashSet
<T> left,
ImmutableSegmentedHashSet
<T> right)
99
public static bool operator ==(
ImmutableSegmentedHashSet
<T>? left,
ImmutableSegmentedHashSet
<T>? right)
102
public static bool operator !=(
ImmutableSegmentedHashSet
<T>? left,
ImmutableSegmentedHashSet
<T>? right)
106
public
ImmutableSegmentedHashSet
<T> Add(T value)
108
var
self = this;
129
public
ImmutableSegmentedHashSet
<T> Clear()
131
var
self = this;
146
public
ImmutableSegmentedHashSet
<T> Except(IEnumerable<T> other)
148
var
self = this;
150
if (other is
ImmutableSegmentedHashSet
<T> { IsEmpty: true })
178
public
ImmutableSegmentedHashSet
<T> Intersect(IEnumerable<T> other)
180
var
self = this;
182
if (self.IsEmpty || other is
ImmutableSegmentedHashSet
<T> { IsEmpty: true })
216
public
ImmutableSegmentedHashSet
<T> Remove(T value)
218
var
self = this;
238
public
ImmutableSegmentedHashSet
<T> SymmetricExcept(IEnumerable<T> other)
240
var
self = this;
242
if (other is
ImmutableSegmentedHashSet
<T> otherSet)
277
public
ImmutableSegmentedHashSet
<T> Union(IEnumerable<T> other)
279
var
self = this;
281
if (other is
ImmutableSegmentedHashSet
<T> otherSet)
303
public
ImmutableSegmentedHashSet
<T> WithComparer(IEqualityComparer<T>? equalityComparer)
305
var
self = this;
318
=> obj is
ImmutableSegmentedHashSet
<T> other && Equals(other);
320
public bool Equals(
ImmutableSegmentedHashSet
<T> other)
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+Builder.cs (2)
21
internal Builder(
ImmutableSegmentedHashSet
<T> set)
112
public
ImmutableSegmentedHashSet
<T> ToImmutable()
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+PrivateMarshal.cs (12)
18
internal static
ImmutableSegmentedHashSet
<T> VolatileRead(in
ImmutableSegmentedHashSet
<T> location)
27
internal static
ImmutableSegmentedHashSet
<T> InterlockedExchange(ref
ImmutableSegmentedHashSet
<T> location,
ImmutableSegmentedHashSet
<T> value)
36
internal static
ImmutableSegmentedHashSet
<T> InterlockedCompareExchange(ref
ImmutableSegmentedHashSet
<T> location,
ImmutableSegmentedHashSet
<T> value,
ImmutableSegmentedHashSet
<T> comparand)
46
internal static
ImmutableSegmentedHashSet
<T> AsImmutableSegmentedHashSet(SegmentedHashSet<T>? set)
49
/// <inheritdoc cref="SegmentedCollectionsMarshal.AsSegmentedHashSet{T}(
ImmutableSegmentedHashSet
{T})"/>
50
internal static SegmentedHashSet<T>? AsSegmentedHashSet(
ImmutableSegmentedHashSet
<T> set)
src\Dependencies\Collections\ImmutableSegmentedHashSet`1+ValueBuilder.cs (6)
21
private
ImmutableSegmentedHashSet
<T> _set;
29
internal ValueBuilder(
ImmutableSegmentedHashSet
<T> set)
64
var
originalSet = RoslynImmutableInterlocked.InterlockedExchange(ref _set, default);
125
else if (other is
ImmutableSegmentedHashSet
<T> otherSet)
235
if (other is
ImmutableSegmentedHashSet
<T> { IsEmpty: true })
262
public
ImmutableSegmentedHashSet
<T> ToImmutable()
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (26)
151
public static bool Update<T>(ref
ImmutableSegmentedHashSet
<T> location, Func<
ImmutableSegmentedHashSet
<T>,
ImmutableSegmentedHashSet
<T>> transformer)
156
var
oldValue =
ImmutableSegmentedHashSet
<T>.PrivateMarshal.VolatileRead(in location);
159
var
newValue = transformer(oldValue);
166
var
interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue);
192
public static bool Update<T, TArg>(ref
ImmutableSegmentedHashSet
<T> location, Func<
ImmutableSegmentedHashSet
<T>, TArg,
ImmutableSegmentedHashSet
<T>> transformer, TArg transformerArgument)
197
var
oldValue =
ImmutableSegmentedHashSet
<T>.PrivateMarshal.VolatileRead(in location);
200
var
newValue = transformer(oldValue, transformerArgument);
207
var
interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue);
223
public static
ImmutableSegmentedHashSet
<T> InterlockedExchange<T>(ref
ImmutableSegmentedHashSet
<T> location,
ImmutableSegmentedHashSet
<T> value)
225
return
ImmutableSegmentedHashSet
<T>.PrivateMarshal.InterlockedExchange(ref location, value);
237
public static
ImmutableSegmentedHashSet
<T> InterlockedCompareExchange<T>(ref
ImmutableSegmentedHashSet
<T> location,
ImmutableSegmentedHashSet
<T> value,
ImmutableSegmentedHashSet
<T> comparand)
239
return
ImmutableSegmentedHashSet
<T>.PrivateMarshal.InterlockedCompareExchange(ref location, value, comparand);
251
public static bool InterlockedInitialize<T>(ref
ImmutableSegmentedHashSet
<T> location,
ImmutableSegmentedHashSet
<T> value)
253
return InterlockedCompareExchange(ref location, value, default(
ImmutableSegmentedHashSet
<T>)).IsDefault;
src\Dependencies\Collections\SegmentedCollectionsMarshal.cs (16)
138
/// Gets an <see cref="
ImmutableSegmentedHashSet
{T}"/> value wrapping the input <see cref="SegmentedHashSet{T}"/>.
141
/// <param name="set">The input segmented hash set to wrap in the returned <see cref="
ImmutableSegmentedHashSet
{T}"/> value.</param>
142
/// <returns>An <see cref="
ImmutableSegmentedHashSet
{T}"/> value wrapping <paramref name="set"/>.</returns>
146
/// set, and that it won't be modified once the returned <see cref="
ImmutableSegmentedHashSet
{T}"/> value starts
148
/// <see cref="
ImmutableSegmentedHashSet
{T}"/> values to change after its creation.
151
/// If <paramref name="set"/> is <see langword="null"/>, the returned <see cref="
ImmutableSegmentedHashSet
{T}"/>
152
/// value will be uninitialized (i.e. its <see cref="
ImmutableSegmentedHashSet
{T}.IsDefault"/> property will be
156
public static
ImmutableSegmentedHashSet
<T> AsImmutableSegmentedHashSet<T>(SegmentedHashSet<T>? set)
157
=>
ImmutableSegmentedHashSet
<T>.PrivateMarshal.AsImmutableSegmentedHashSet(set);
160
/// Gets the underlying <see cref="SegmentedHashSet{T}"/> for an input <see cref="
ImmutableSegmentedHashSet
{T}"/> value.
162
/// <typeparam name="T">The type of elements in the input <see cref="
ImmutableSegmentedHashSet
{T}"/> value.</typeparam>
163
/// <param name="set">The input <see cref="
ImmutableSegmentedHashSet
{T}"/> value to get the underlying <see cref="SegmentedHashSet{T}"/> from.</param>
169
/// don't expect the contents of the <see cref="
ImmutableSegmentedHashSet
{T}"/> value to change.
172
/// If <paramref name="set"/> is uninitialized (i.e. its <see cref="
ImmutableSegmentedHashSet
{T}.IsDefault"/>
176
public static SegmentedHashSet<T>? AsSegmentedHashSet<T>(
ImmutableSegmentedHashSet
<T> set)
177
=>
ImmutableSegmentedHashSet
<T>.PrivateMarshal.AsSegmentedHashSet(set);