14 instantiations of ImmutableSegmentedList
Microsoft.CodeAnalysis (14)
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1.cs (6)
76
public static readonly ImmutableSegmentedList<T> Empty =
new
(new SegmentedList<T>());
148
return new
ImmutableSegmentedList
<T>(list);
177
return new
ImmutableSegmentedList
<T>(list);
209
=> new
ImmutableSegmentedList
<TOutput>(_list.ConvertAll(converter));
232
=> new
ImmutableSegmentedList
<T>(_list.FindAll(match));
300
return new
ImmutableSegmentedList
<T>(self._list.GetRange(index, count));
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (4)
26
return new
ImmutableSegmentedList
<T>(list);
35
return new
ImmutableSegmentedList
<T>(list);
44
return new
ImmutableSegmentedList
<T>(list);
49
=> list is not null ? new
ImmutableSegmentedList
<T>(list) : default;
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+ValueBuilder.cs (4)
126
=> new
ImmutableSegmentedList
<TOutput>(ReadOnlyList.ConvertAll(converter));
144
=> new
ImmutableSegmentedList
<T>(ReadOnlyList.FindAll(match));
196
return new
ImmutableSegmentedList
<T>(ReadOnlyList.GetRange(index, count));
327
_list = new
ImmutableSegmentedList
<T>(ReadOnlyList);
172 references to ImmutableSegmentedList
Microsoft.CodeAnalysis (151)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (1)
1350
internal static int BinarySearch<TElement, TValue>(this
ImmutableSegmentedList
<TElement> array, TValue value, Func<TElement, TValue, int> comparer)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (26)
33
public static bool Update<T>(ref
ImmutableSegmentedList
<T> location, Func<
ImmutableSegmentedList
<T>,
ImmutableSegmentedList
<T>> transformer)
38
var
oldValue =
ImmutableSegmentedList
<T>.PrivateMarshal.VolatileRead(in location);
41
var
newValue = transformer(oldValue);
48
var
interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue);
74
public static bool Update<T, TArg>(ref
ImmutableSegmentedList
<T> location, Func<
ImmutableSegmentedList
<T>, TArg,
ImmutableSegmentedList
<T>> transformer, TArg transformerArgument)
79
var
oldValue =
ImmutableSegmentedList
<T>.PrivateMarshal.VolatileRead(in location);
82
var
newValue = transformer(oldValue, transformerArgument);
89
var
interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue);
105
public static
ImmutableSegmentedList
<T> InterlockedExchange<T>(ref
ImmutableSegmentedList
<T> location,
ImmutableSegmentedList
<T> value)
107
return
ImmutableSegmentedList
<T>.PrivateMarshal.InterlockedExchange(ref location, value);
119
public static
ImmutableSegmentedList
<T> InterlockedCompareExchange<T>(ref
ImmutableSegmentedList
<T> location,
ImmutableSegmentedList
<T> value,
ImmutableSegmentedList
<T> comparand)
121
return
ImmutableSegmentedList
<T>.PrivateMarshal.InterlockedCompareExchange(ref location, value, comparand);
133
public static bool InterlockedInitialize<T>(ref
ImmutableSegmentedList
<T> location,
ImmutableSegmentedList
<T> value)
135
return InterlockedCompareExchange(ref location, value, default(
ImmutableSegmentedList
<T>)).IsDefault;
src\Dependencies\Collections\Segmented\ImmutableSegmentedList.cs (15)
16
public static
ImmutableSegmentedList
<T> Create<T>()
17
=>
ImmutableSegmentedList
<T>.Empty;
20
public static
ImmutableSegmentedList
<T> Create<T>(T item)
21
=>
ImmutableSegmentedList
<T>.Empty.Add(item);
24
public static
ImmutableSegmentedList
<T> Create<T>(params T[] items)
25
=>
ImmutableSegmentedList
<T>.Empty.AddRange(items);
28
public static
ImmutableSegmentedList
<T>.Builder CreateBuilder<T>()
29
=>
ImmutableSegmentedList
<T>.Empty.ToBuilder();
32
public static
ImmutableSegmentedList
<T> CreateRange<T>(IEnumerable<T> items)
33
=>
ImmutableSegmentedList
<T>.Empty.AddRange(items);
36
public static
ImmutableSegmentedList
<T> ToImmutableSegmentedList<T>(this IEnumerable<T> source)
38
if (source is
ImmutableSegmentedList
<T> existingList)
41
return
ImmutableSegmentedList
<T>.Empty.AddRange(source);
45
public static
ImmutableSegmentedList
<T> ToImmutableSegmentedList<T>(this
ImmutableSegmentedList
<T>.Builder builder)
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1.cs (61)
20
/// <para>There are different scenarios best for <see cref="
ImmutableSegmentedList
{T}"/> and others
24
/// <see cref="
ImmutableSegmentedList
{T}"/>:</para>
29
/// <description><see cref="
ImmutableSegmentedList
{T}"/> Complexity</description>
73
internal readonly partial struct ImmutableSegmentedList<T> : IImmutableList<T>, IReadOnlyList<T>, IList<T>, IList, IEquatable<
ImmutableSegmentedList
<T>>
76
public static readonly
ImmutableSegmentedList
<T> Empty = new(new SegmentedList<T>());
114
public static bool operator ==(
ImmutableSegmentedList
<T> left,
ImmutableSegmentedList
<T> right)
117
public static bool operator !=(
ImmutableSegmentedList
<T> left,
ImmutableSegmentedList
<T> right)
120
public static bool operator ==(
ImmutableSegmentedList
<T>? left,
ImmutableSegmentedList
<T>? right)
123
public static bool operator !=(
ImmutableSegmentedList
<T>? left,
ImmutableSegmentedList
<T>? right)
129
var
self = this;
141
public
ImmutableSegmentedList
<T> Add(T value)
143
var
self = this;
161
public
ImmutableSegmentedList
<T> AddRange(IEnumerable<T> items)
163
var
self = this;
171
if (items is
ImmutableSegmentedList
<T> immutableList)
173
else if (items is
ImmutableSegmentedList
<T>.Builder builder)
201
public
ImmutableSegmentedList
<T> Clear()
208
public
ImmutableSegmentedList
<TOutput> ConvertAll<TOutput>(Converter<T, TOutput> converter)
231
public
ImmutableSegmentedList
<T> FindAll(Predicate<T> match)
257
var
self = this;
272
var
self = this;
293
public
ImmutableSegmentedList
<T> GetRange(int index, int count)
295
var
self = this;
310
public
ImmutableSegmentedList
<T> Insert(int index, T item)
312
var
self = this;
325
public
ImmutableSegmentedList
<T> InsertRange(int index, IEnumerable<T> items)
327
var
self = this;
341
var
self = this;
361
public
ImmutableSegmentedList
<T> Remove(T value)
363
var
self = this;
373
public
ImmutableSegmentedList
<T> Remove(T value, IEqualityComparer<T>? equalityComparer)
375
var
self = this;
385
public
ImmutableSegmentedList
<T> RemoveAll(Predicate<T> match)
395
public
ImmutableSegmentedList
<T> RemoveAt(int index)
404
public
ImmutableSegmentedList
<T> RemoveRange(IEnumerable<T> items)
409
var
self = this;
428
public
ImmutableSegmentedList
<T> RemoveRange(IEnumerable<T> items, IEqualityComparer<T>? equalityComparer)
433
var
self = this;
452
public
ImmutableSegmentedList
<T> RemoveRange(int index, int count)
454
var
self = this;
468
public
ImmutableSegmentedList
<T> Replace(T oldValue, T newValue)
470
var
self = this;
482
public
ImmutableSegmentedList
<T> Replace(T oldValue, T newValue, IEqualityComparer<T>? equalityComparer)
484
var
self = this;
496
public
ImmutableSegmentedList
<T> Reverse()
498
var
self = this;
508
public
ImmutableSegmentedList
<T> Reverse(int index, int count)
516
public
ImmutableSegmentedList
<T> SetItem(int index, T value)
525
public
ImmutableSegmentedList
<T> Sort()
527
var
self = this;
539
public
ImmutableSegmentedList
<T> Sort(IComparer<T>? comparer)
541
var
self = this;
553
public
ImmutableSegmentedList
<T> Sort(Comparison<T> comparison)
560
var
self = this;
572
public
ImmutableSegmentedList
<T> Sort(int index, int count, IComparer<T>? comparer)
592
return obj is
ImmutableSegmentedList
<T> other
596
public bool Equals(
ImmutableSegmentedList
<T> other)
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+Builder.cs (5)
23
internal Builder(
ImmutableSegmentedList
<T> list)
80
public
ImmutableSegmentedList
<TOutput> ConvertAll<TOutput>(Converter<T, TOutput> converter)
103
public
ImmutableSegmentedList
<T> FindAll(Predicate<T> match)
143
public
ImmutableSegmentedList
<T> GetRange(int index, int count)
219
public
ImmutableSegmentedList
<T> ToImmutable()
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+PrivateMarshal.cs (12)
20
internal static
ImmutableSegmentedList
<T> VolatileRead(in
ImmutableSegmentedList
<T> location)
29
internal static
ImmutableSegmentedList
<T> InterlockedExchange(ref
ImmutableSegmentedList
<T> location,
ImmutableSegmentedList
<T> value)
38
internal static
ImmutableSegmentedList
<T> InterlockedCompareExchange(ref
ImmutableSegmentedList
<T> location,
ImmutableSegmentedList
<T> value,
ImmutableSegmentedList
<T> comparand)
48
internal static
ImmutableSegmentedList
<T> AsImmutableSegmentedList(SegmentedList<T>? list)
51
/// <inheritdoc cref="SegmentedCollectionsMarshal.AsSegmentedList{T}(
ImmutableSegmentedList
{T})"/>
52
internal static SegmentedList<T>? AsSegmentedList(
ImmutableSegmentedList
<T> list)
src\Dependencies\Collections\Segmented\ImmutableSegmentedList`1+ValueBuilder.cs (7)
21
private
ImmutableSegmentedList
<T> _list;
29
internal ValueBuilder(
ImmutableSegmentedList
<T> list)
76
var
originalList = RoslynImmutableInterlocked.InterlockedExchange(ref _list, default);
125
public readonly
ImmutableSegmentedList
<TOutput> ConvertAll<TOutput>(Converter<T, TOutput> converter)
143
public readonly
ImmutableSegmentedList
<T> FindAll(Predicate<T> match)
191
public
ImmutableSegmentedList
<T> GetRange(int index, int count)
325
public
ImmutableSegmentedList
<T> ToImmutable()
src\Dependencies\Collections\Segmented\ImmutableSegmentedListExtensions.cs (8)
17
public static bool All<T>(this
ImmutableSegmentedList
<T> immutableList, Func<T, bool> predicate)
33
public static bool Any<T>(this
ImmutableSegmentedList
<T> immutableList)
41
public static bool Any<T>(this
ImmutableSegmentedList
<T>.Builder builder)
49
public static bool Any<T>(this
ImmutableSegmentedList
<T> immutableList, Func<T, bool> predicate)
65
public static T Last<T>(this
ImmutableSegmentedList
<T> immutableList)
74
public static T Last<T>(this
ImmutableSegmentedList
<T>.Builder builder)
86
public static T Last<T>(this
ImmutableSegmentedList
<T> immutableList, Func<T, bool> predicate)
103
public static IEnumerable<TResult> Select<T, TResult>(this
ImmutableSegmentedList
<T> immutableList, Func<T, TResult> selector)
src\Dependencies\Collections\Segmented\SegmentedCollectionsMarshal.cs (16)
98
/// Gets an <see cref="
ImmutableSegmentedList
{T}"/> value wrapping the input <see cref="SegmentedList{T}"/>.
101
/// <param name="list">The input segmented list to wrap in the returned <see cref="
ImmutableSegmentedList
{T}"/> value.</param>
102
/// <returns>An <see cref="
ImmutableSegmentedList
{T}"/> value wrapping <paramref name="list"/>.</returns>
106
/// list, and that it won't be modified once the returned <see cref="
ImmutableSegmentedList
{T}"/> value starts
108
/// <see cref="
ImmutableSegmentedList
{T}"/> values to change after its creation.
111
/// If <paramref name="list"/> is <see langword="null"/>, the returned <see cref="
ImmutableSegmentedList
{T}"/> value
112
/// will be uninitialized (i.e. its <see cref="
ImmutableSegmentedList
{T}.IsDefault"/> property will be
116
public static
ImmutableSegmentedList
<T> AsImmutableSegmentedList<T>(SegmentedList<T>? list)
117
=>
ImmutableSegmentedList
<T>.PrivateMarshal.AsImmutableSegmentedList(list);
120
/// Gets the underlying <see cref="SegmentedList{T}"/> for an input <see cref="
ImmutableSegmentedList
{T}"/> value.
122
/// <typeparam name="T">The type of elements in the input <see cref="
ImmutableSegmentedList
{T}"/> value.</typeparam>
123
/// <param name="list">The input <see cref="
ImmutableSegmentedList
{T}"/> value to get the underlying <see cref="SegmentedList{T}"/> from.</param>
129
/// don't expect the contents of the <see cref="
ImmutableSegmentedList
{T}"/> value to change.
132
/// If <paramref name="list"/> is uninitialized (i.e. its <see cref="
ImmutableSegmentedList
{T}.IsDefault"/> property is
136
public static SegmentedList<T>? AsSegmentedList<T>(
ImmutableSegmentedList
<T> list)
137
=>
ImmutableSegmentedList
<T>.PrivateMarshal.AsSegmentedList(list);
Microsoft.CodeAnalysis.UnitTests (21)
Collections\ImmutableListTestBase.cs (2)
546
/// Asserts that the <see cref="
ImmutableSegmentedList
{T}"/> or <see cref="
ImmutableSegmentedList
{T}.Builder"/>'s
Collections\ImmutableSegmentedListBuilderTest.cs (2)
56
var
list = ImmutableSegmentedList<int>.Empty.Add(1);
118
var
collection = ImmutableSegmentedList<int>.Empty.Add(1);
Collections\ImmutableSegmentedListTest.cs (17)
43
var
actual = ImmutableSegmentedList<int>.Empty;
107
var
empty = ImmutableSegmentedList<GenericParameterHelper?>.Empty;
126
var
list = ImmutableSegmentedList<int>.Empty;
146
var
list = ImmutableSegmentedList<int>.Empty;
158
var
list = ImmutableSegmentedList<int>.Empty;
193
var
list = ImmutableSegmentedList<int>.Empty;
245
var
list = ImmutableSegmentedList<int>.Empty;
278
var
list = ImmutableSegmentedList<int>.Empty;
294
var
list = ImmutableSegmentedList<int>.Empty;
312
var
list = ImmutableSegmentedList<GenericParameterHelper?>.Empty;
396
var
list = ImmutableSegmentedList<int>.Empty;
415
var
list = ImmutableSegmentedList<int>.Empty;
422
var
list = ImmutableSegmentedList<int>.Empty;
450
var
list = ImmutableSegmentedList<string>.Empty;
473
var
list = ImmutableSegmentedList.CreateRange(Enumerable.Range(1, 3));
525
var
list = ImmutableSegmentedList<int>.Empty.Add(3).Add(5).Add(8);
844
var
actual = list.RemoveAll(test);