11 instantiations of ImmutableSegmentedList
Microsoft.CodeAnalysis (11)
src\Dependencies\Collections\ImmutableSegmentedList`1.cs (6)
74
public static readonly ImmutableSegmentedList<T> Empty =
new
(new SegmentedList<T>());
146
return new
ImmutableSegmentedList
<T>(list);
175
return new
ImmutableSegmentedList
<T>(list);
207
=> new
ImmutableSegmentedList
<TOutput>(_list.ConvertAll(converter));
230
=> new
ImmutableSegmentedList
<T>(_list.FindAll(match));
298
return new
ImmutableSegmentedList
<T>(self._list.GetRange(index, count));
src\Dependencies\Collections\ImmutableSegmentedList`1+PrivateMarshal.cs (1)
47
=> list is not null ? new
ImmutableSegmentedList
<T>(list) : default;
src\Dependencies\Collections\ImmutableSegmentedList`1+ValueBuilder.cs (4)
124
=> new
ImmutableSegmentedList
<TOutput>(ReadOnlyList.ConvertAll(converter));
142
=> new
ImmutableSegmentedList
<T>(ReadOnlyList.FindAll(match));
194
return new
ImmutableSegmentedList
<T>(ReadOnlyList.GetRange(index, count));
325
_list = new
ImmutableSegmentedList
<T>(ReadOnlyList);
188 references to ImmutableSegmentedList
Microsoft.CodeAnalysis (151)
Collections\ImmutableArrayExtensions.cs (1)
1274
internal static int BinarySearch<TElement, TValue>(this
ImmutableSegmentedList
<TElement> array, TValue value, Func<TElement, TValue, int> comparer)
src\Dependencies\Collections\ImmutableSegmentedList.cs (15)
14
public static
ImmutableSegmentedList
<T> Create<T>()
15
=>
ImmutableSegmentedList
<T>.Empty;
18
public static
ImmutableSegmentedList
<T> Create<T>(T item)
19
=>
ImmutableSegmentedList
<T>.Empty.Add(item);
22
public static
ImmutableSegmentedList
<T> Create<T>(params T[] items)
23
=>
ImmutableSegmentedList
<T>.Empty.AddRange(items);
26
public static
ImmutableSegmentedList
<T>.Builder CreateBuilder<T>()
27
=>
ImmutableSegmentedList
<T>.Empty.ToBuilder();
30
public static
ImmutableSegmentedList
<T> CreateRange<T>(IEnumerable<T> items)
31
=>
ImmutableSegmentedList
<T>.Empty.AddRange(items);
34
public static
ImmutableSegmentedList
<T> ToImmutableSegmentedList<T>(this IEnumerable<T> source)
36
if (source is
ImmutableSegmentedList
<T> existingList)
39
return
ImmutableSegmentedList
<T>.Empty.AddRange(source);
43
public static
ImmutableSegmentedList
<T> ToImmutableSegmentedList<T>(this
ImmutableSegmentedList
<T>.Builder builder)
src\Dependencies\Collections\ImmutableSegmentedList`1.cs (61)
18
/// <para>There are different scenarios best for <see cref="
ImmutableSegmentedList
{T}"/> and others
22
/// <see cref="
ImmutableSegmentedList
{T}"/>:</para>
27
/// <description><see cref="
ImmutableSegmentedList
{T}"/> Complexity</description>
71
internal readonly partial struct ImmutableSegmentedList<T> : IImmutableList<T>, IReadOnlyList<T>, IList<T>, IList, IEquatable<
ImmutableSegmentedList
<T>>
74
public static readonly
ImmutableSegmentedList
<T> Empty = new(new SegmentedList<T>());
112
public static bool operator ==(
ImmutableSegmentedList
<T> left,
ImmutableSegmentedList
<T> right)
115
public static bool operator !=(
ImmutableSegmentedList
<T> left,
ImmutableSegmentedList
<T> right)
118
public static bool operator ==(
ImmutableSegmentedList
<T>? left,
ImmutableSegmentedList
<T>? right)
121
public static bool operator !=(
ImmutableSegmentedList
<T>? left,
ImmutableSegmentedList
<T>? right)
127
var
self = this;
139
public
ImmutableSegmentedList
<T> Add(T value)
141
var
self = this;
159
public
ImmutableSegmentedList
<T> AddRange(IEnumerable<T> items)
161
var
self = this;
169
if (items is
ImmutableSegmentedList
<T> immutableList)
171
else if (items is
ImmutableSegmentedList
<T>.Builder builder)
199
public
ImmutableSegmentedList
<T> Clear()
206
public
ImmutableSegmentedList
<TOutput> ConvertAll<TOutput>(Converter<T, TOutput> converter)
229
public
ImmutableSegmentedList
<T> FindAll(Predicate<T> match)
255
var
self = this;
270
var
self = this;
291
public
ImmutableSegmentedList
<T> GetRange(int index, int count)
293
var
self = this;
308
public
ImmutableSegmentedList
<T> Insert(int index, T item)
310
var
self = this;
323
public
ImmutableSegmentedList
<T> InsertRange(int index, IEnumerable<T> items)
325
var
self = this;
339
var
self = this;
359
public
ImmutableSegmentedList
<T> Remove(T value)
361
var
self = this;
371
public
ImmutableSegmentedList
<T> Remove(T value, IEqualityComparer<T>? equalityComparer)
373
var
self = this;
383
public
ImmutableSegmentedList
<T> RemoveAll(Predicate<T> match)
393
public
ImmutableSegmentedList
<T> RemoveAt(int index)
402
public
ImmutableSegmentedList
<T> RemoveRange(IEnumerable<T> items)
407
var
self = this;
426
public
ImmutableSegmentedList
<T> RemoveRange(IEnumerable<T> items, IEqualityComparer<T>? equalityComparer)
431
var
self = this;
450
public
ImmutableSegmentedList
<T> RemoveRange(int index, int count)
452
var
self = this;
466
public
ImmutableSegmentedList
<T> Replace(T oldValue, T newValue)
468
var
self = this;
480
public
ImmutableSegmentedList
<T> Replace(T oldValue, T newValue, IEqualityComparer<T>? equalityComparer)
482
var
self = this;
494
public
ImmutableSegmentedList
<T> Reverse()
496
var
self = this;
506
public
ImmutableSegmentedList
<T> Reverse(int index, int count)
514
public
ImmutableSegmentedList
<T> SetItem(int index, T value)
523
public
ImmutableSegmentedList
<T> Sort()
525
var
self = this;
537
public
ImmutableSegmentedList
<T> Sort(IComparer<T>? comparer)
539
var
self = this;
551
public
ImmutableSegmentedList
<T> Sort(Comparison<T> comparison)
558
var
self = this;
570
public
ImmutableSegmentedList
<T> Sort(int index, int count, IComparer<T>? comparer)
590
return obj is
ImmutableSegmentedList
<T> other
594
public bool Equals(
ImmutableSegmentedList
<T> other)
src\Dependencies\Collections\ImmutableSegmentedList`1+Builder.cs (5)
21
internal Builder(
ImmutableSegmentedList
<T> list)
78
public
ImmutableSegmentedList
<TOutput> ConvertAll<TOutput>(Converter<T, TOutput> converter)
101
public
ImmutableSegmentedList
<T> FindAll(Predicate<T> match)
141
public
ImmutableSegmentedList
<T> GetRange(int index, int count)
217
public
ImmutableSegmentedList
<T> ToImmutable()
src\Dependencies\Collections\ImmutableSegmentedList`1+PrivateMarshal.cs (12)
18
internal static
ImmutableSegmentedList
<T> VolatileRead(in
ImmutableSegmentedList
<T> location)
27
internal static
ImmutableSegmentedList
<T> InterlockedExchange(ref
ImmutableSegmentedList
<T> location,
ImmutableSegmentedList
<T> value)
36
internal static
ImmutableSegmentedList
<T> InterlockedCompareExchange(ref
ImmutableSegmentedList
<T> location,
ImmutableSegmentedList
<T> value,
ImmutableSegmentedList
<T> comparand)
46
internal static
ImmutableSegmentedList
<T> AsImmutableSegmentedList(SegmentedList<T>? list)
49
/// <inheritdoc cref="SegmentedCollectionsMarshal.AsSegmentedList{T}(
ImmutableSegmentedList
{T})"/>
50
internal static SegmentedList<T>? AsSegmentedList(
ImmutableSegmentedList
<T> list)
src\Dependencies\Collections\ImmutableSegmentedList`1+ValueBuilder.cs (7)
19
private
ImmutableSegmentedList
<T> _list;
27
internal ValueBuilder(
ImmutableSegmentedList
<T> list)
74
var
originalList = RoslynImmutableInterlocked.InterlockedExchange(ref _list, default);
123
public readonly
ImmutableSegmentedList
<TOutput> ConvertAll<TOutput>(Converter<T, TOutput> converter)
141
public readonly
ImmutableSegmentedList
<T> FindAll(Predicate<T> match)
189
public
ImmutableSegmentedList
<T> GetRange(int index, int count)
323
public
ImmutableSegmentedList
<T> ToImmutable()
src\Dependencies\Collections\ImmutableSegmentedListExtensions.cs (8)
15
public static bool All<T>(this
ImmutableSegmentedList
<T> immutableList, Func<T, bool> predicate)
31
public static bool Any<T>(this
ImmutableSegmentedList
<T> immutableList)
39
public static bool Any<T>(this
ImmutableSegmentedList
<T>.Builder builder)
47
public static bool Any<T>(this
ImmutableSegmentedList
<T> immutableList, Func<T, bool> predicate)
63
public static T Last<T>(this
ImmutableSegmentedList
<T> immutableList)
72
public static T Last<T>(this
ImmutableSegmentedList
<T>.Builder builder)
84
public static T Last<T>(this
ImmutableSegmentedList
<T> immutableList, Func<T, bool> predicate)
101
public static IEnumerable<TResult> Select<T, TResult>(this
ImmutableSegmentedList
<T> immutableList, Func<T, TResult> selector)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (26)
30
public static bool Update<T>(ref
ImmutableSegmentedList
<T> location, Func<
ImmutableSegmentedList
<T>,
ImmutableSegmentedList
<T>> transformer)
35
var
oldValue =
ImmutableSegmentedList
<T>.PrivateMarshal.VolatileRead(in location);
38
var
newValue = transformer(oldValue);
45
var
interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue);
71
public static bool Update<T, TArg>(ref
ImmutableSegmentedList
<T> location, Func<
ImmutableSegmentedList
<T>, TArg,
ImmutableSegmentedList
<T>> transformer, TArg transformerArgument)
76
var
oldValue =
ImmutableSegmentedList
<T>.PrivateMarshal.VolatileRead(in location);
79
var
newValue = transformer(oldValue, transformerArgument);
86
var
interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue);
102
public static
ImmutableSegmentedList
<T> InterlockedExchange<T>(ref
ImmutableSegmentedList
<T> location,
ImmutableSegmentedList
<T> value)
104
return
ImmutableSegmentedList
<T>.PrivateMarshal.InterlockedExchange(ref location, value);
116
public static
ImmutableSegmentedList
<T> InterlockedCompareExchange<T>(ref
ImmutableSegmentedList
<T> location,
ImmutableSegmentedList
<T> value,
ImmutableSegmentedList
<T> comparand)
118
return
ImmutableSegmentedList
<T>.PrivateMarshal.InterlockedCompareExchange(ref location, value, comparand);
130
public static bool InterlockedInitialize<T>(ref
ImmutableSegmentedList
<T> location,
ImmutableSegmentedList
<T> value)
132
return InterlockedCompareExchange(ref location, value, default(
ImmutableSegmentedList
<T>)).IsDefault;
src\Dependencies\Collections\SegmentedCollectionsMarshal.cs (16)
96
/// Gets an <see cref="
ImmutableSegmentedList
{T}"/> value wrapping the input <see cref="SegmentedList{T}"/>.
99
/// <param name="list">The input segmented list to wrap in the returned <see cref="
ImmutableSegmentedList
{T}"/> value.</param>
100
/// <returns>An <see cref="
ImmutableSegmentedList
{T}"/> value wrapping <paramref name="list"/>.</returns>
104
/// list, and that it won't be modified once the returned <see cref="
ImmutableSegmentedList
{T}"/> value starts
106
/// <see cref="
ImmutableSegmentedList
{T}"/> values to change after its creation.
109
/// If <paramref name="list"/> is <see langword="null"/>, the returned <see cref="
ImmutableSegmentedList
{T}"/> value
110
/// will be uninitialized (i.e. its <see cref="
ImmutableSegmentedList
{T}.IsDefault"/> property will be
114
public static
ImmutableSegmentedList
<T> AsImmutableSegmentedList<T>(SegmentedList<T>? list)
115
=>
ImmutableSegmentedList
<T>.PrivateMarshal.AsImmutableSegmentedList(list);
118
/// Gets the underlying <see cref="SegmentedList{T}"/> for an input <see cref="
ImmutableSegmentedList
{T}"/> value.
120
/// <typeparam name="T">The type of elements in the input <see cref="
ImmutableSegmentedList
{T}"/> value.</typeparam>
121
/// <param name="list">The input <see cref="
ImmutableSegmentedList
{T}"/> value to get the underlying <see cref="SegmentedList{T}"/> from.</param>
127
/// don't expect the contents of the <see cref="
ImmutableSegmentedList
{T}"/> value to change.
130
/// If <paramref name="list"/> is uninitialized (i.e. its <see cref="
ImmutableSegmentedList
{T}.IsDefault"/> property is
134
public static SegmentedList<T>? AsSegmentedList<T>(
ImmutableSegmentedList
<T> list)
135
=>
ImmutableSegmentedList
<T>.PrivateMarshal.AsSegmentedList(list);
Microsoft.CodeAnalysis.UnitTests (37)
Collections\ImmutableListTestBase.cs (15)
116
var
list = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(5, 3));
136
var
list = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(1, 5));
145
var
list = ImmutableSegmentedList<int>.Empty.AddRange(new[] { 2, 3, 4, 5, 6 });
155
var
list = ImmutableSegmentedList<int>.Empty.AddRange(new[] { 2, 3, 4, 5, 6 });
163
var
list = ImmutableSegmentedList<int>.Empty.AddRange(new[] { 2, 3, 4, 5, 6 });
175
var
list = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(100, 5).Concat(Enumerable.Range(100, 5)));
229
var
list = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(100, 5).Concat(Enumerable.Range(100, 5)));
333
var
list = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(5, 10));
344
var
list = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(5, 10));
362
var
list = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(5, 10));
371
var
list = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(5, 10));
382
var
list = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(5, 10));
408
foreach (
var
scenario in scenarios)
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 (18)
43
var
actual = ImmutableSegmentedList<int>.Empty;
107
var
empty = ImmutableSegmentedList<GenericParameterHelper?>.Empty;
126
var
list = ImmutableSegmentedList<int>.Empty;
139
var
bulkList = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(1, 10).Select(i => i * 10));
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);
Collections\IndexOfTests.cs (2)
50
var
list = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(100, 5).Concat(Enumerable.Range(100, 5)));
118
var
list = ImmutableSegmentedList<int>.Empty.AddRange(Enumerable.Range(100, 5).Concat(Enumerable.Range(100, 5)));