10 instantiations of ImmutableSegmentedDictionary
Microsoft.Build.Framework (10)
ImmutableSegmentedDictionary`2.cs (6)
73public static readonly ImmutableSegmentedDictionary<TKey, TValue> Empty = new(new SegmentedDictionary<TKey, TValue>()); 152return new ImmutableSegmentedDictionary<TKey, TValue>(dictionary); 179return new ImmutableSegmentedDictionary<TKey, TValue>(dictionary); 216return new ImmutableSegmentedDictionary<TKey, TValue>(dictionary); 239return new ImmutableSegmentedDictionary<TKey, TValue>(dictionary); 295return new ImmutableSegmentedDictionary<TKey, TValue>(new SegmentedDictionary<TKey, TValue>(keyComparer));
ImmutableSegmentedDictionary`2+Builder.cs (1)
217_dictionary = new ImmutableSegmentedDictionary<TKey, TValue>(ReadOnlyDictionary);
ImmutableSegmentedDictionary`2+PrivateInterlocked.cs (3)
23return new ImmutableSegmentedDictionary<TKey, TValue>(dictionary); 32return new ImmutableSegmentedDictionary<TKey, TValue>(dictionary); 41return new ImmutableSegmentedDictionary<TKey, TValue>(dictionary);
145 references to ImmutableSegmentedDictionary
Microsoft.Build.Framework (145)
ImmutableSegmentedDictionary.cs (21)
17public static ImmutableSegmentedDictionary<TKey, TValue> Create<TKey, TValue>() 19=> ImmutableSegmentedDictionary<TKey, TValue>.Empty; 21public static ImmutableSegmentedDictionary<TKey, TValue> Create<TKey, TValue>(IEqualityComparer<TKey>? keyComparer) 23=> ImmutableSegmentedDictionary<TKey, TValue>.Empty.WithComparer(keyComparer); 25public static ImmutableSegmentedDictionary<TKey, TValue>.Builder CreateBuilder<TKey, TValue>() 29public static ImmutableSegmentedDictionary<TKey, TValue>.Builder CreateBuilder<TKey, TValue>(IEqualityComparer<TKey>? keyComparer) 33public static ImmutableSegmentedDictionary<TKey, TValue> CreateRange<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>> items) 35=> ImmutableSegmentedDictionary<TKey, TValue>.Empty.AddRange(items); 37public static ImmutableSegmentedDictionary<TKey, TValue> CreateRange<TKey, TValue>(IEqualityComparer<TKey>? keyComparer, IEnumerable<KeyValuePair<TKey, TValue>> items) 39=> ImmutableSegmentedDictionary<TKey, TValue>.Empty.WithComparer(keyComparer).AddRange(items); 41public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> items) 45public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TKey, TValue>(this ImmutableSegmentedDictionary<TKey, TValue>.Builder builder) 54public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TKey, TValue>(this IEnumerable<KeyValuePair<TKey, TValue>> items, IEqualityComparer<TKey>? keyComparer) 60if (items is ImmutableSegmentedDictionary<TKey, TValue> existingDictionary) 63return ImmutableSegmentedDictionary<TKey, TValue>.Empty.WithComparer(keyComparer).AddRange(items); 66public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector) 70public static ImmutableSegmentedDictionary<TKey, TValue> ToImmutableSegmentedDictionary<TSource, TKey, TValue>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TValue> elementSelector, IEqualityComparer<TKey>? keyComparer) 80return ImmutableSegmentedDictionary<TKey, TValue>.Empty.WithComparer(keyComparer) 84public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) 88public static ImmutableSegmentedDictionary<TKey, TSource> ToImmutableSegmentedDictionary<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IEqualityComparer<TKey>? keyComparer)
ImmutableSegmentedDictionary`2.cs (35)
17/// <para>There are different scenarios best for <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> and others 20/// <para>In general, <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> is applicable in scenarios most like 26/// <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/>:</para> 31/// <description><see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> Complexity</description> 70internal readonly partial struct ImmutableSegmentedDictionary<TKey, TValue> : IImmutableDictionary<TKey, TValue>, IDictionary<TKey, TValue>, IReadOnlyDictionary<TKey, TValue>, IDictionary, IEquatable<ImmutableSegmentedDictionary<TKey, TValue>> 73public static readonly ImmutableSegmentedDictionary<TKey, TValue> Empty = new(new SegmentedDictionary<TKey, TValue>()); 132public static bool operator ==(ImmutableSegmentedDictionary<TKey, TValue> left, ImmutableSegmentedDictionary<TKey, TValue> right) 135public static bool operator !=(ImmutableSegmentedDictionary<TKey, TValue> left, ImmutableSegmentedDictionary<TKey, TValue> right) 138public static bool operator ==(ImmutableSegmentedDictionary<TKey, TValue>? left, ImmutableSegmentedDictionary<TKey, TValue>? right) 141public static bool operator !=(ImmutableSegmentedDictionary<TKey, TValue>? left, ImmutableSegmentedDictionary<TKey, TValue>? right) 144public ImmutableSegmentedDictionary<TKey, TValue> Add(TKey key, TValue value) 146var self = this; 155public ImmutableSegmentedDictionary<TKey, TValue> AddRange(IEnumerable<KeyValuePair<TKey, TValue>> pairs) 157var self = this; 160if (self.IsEmpty && TryCastToImmutableSegmentedDictionary(pairs, out var other) && self.KeyComparer == other.KeyComparer) 182public ImmutableSegmentedDictionary<TKey, TValue> Clear() 184var self = this; 208public ImmutableSegmentedDictionary<TKey, TValue> Remove(TKey key) 210var self = this; 219public ImmutableSegmentedDictionary<TKey, TValue> RemoveRange(IEnumerable<TKey> keys) 229public ImmutableSegmentedDictionary<TKey, TValue> SetItem(TKey key, TValue value) 231var self = this; 242public ImmutableSegmentedDictionary<TKey, TValue> SetItems(IEnumerable<KeyValuePair<TKey, TValue>> items) 258var self = this; 277public ImmutableSegmentedDictionary<TKey, TValue> WithComparer(IEqualityComparer<TKey>? keyComparer) 281var self = this; 312return obj is ImmutableSegmentedDictionary<TKey, TValue> other 316public bool Equals(ImmutableSegmentedDictionary<TKey, TValue> other) 381private static bool TryCastToImmutableSegmentedDictionary(IEnumerable<KeyValuePair<TKey, TValue>> pairs, out ImmutableSegmentedDictionary<TKey, TValue> other) 383if (pairs is ImmutableSegmentedDictionary<TKey, TValue> dictionary) 389if (pairs is ImmutableSegmentedDictionary<TKey, TValue>.Builder builder)
ImmutableSegmentedDictionary`2+Builder.cs (3)
19private ImmutableSegmentedDictionary<TKey, TValue> _dictionary; 27internal Builder(ImmutableSegmentedDictionary<TKey, TValue> dictionary) 215public ImmutableSegmentedDictionary<TKey, TValue> ToImmutable()
ImmutableSegmentedDictionary`2+Builder+KeyCollection.cs (3)
18private readonly ImmutableSegmentedDictionary<TKey, TValue>.Builder _dictionary; 20internal KeyCollection(ImmutableSegmentedDictionary<TKey, TValue>.Builder dictionary) 46public ImmutableSegmentedDictionary<TKey, TValue>.KeyCollection.Enumerator GetEnumerator()
ImmutableSegmentedDictionary`2+Builder+ValueCollection.cs (3)
18private readonly ImmutableSegmentedDictionary<TKey, TValue>.Builder _dictionary; 20internal ValueCollection(ImmutableSegmentedDictionary<TKey, TValue>.Builder dictionary) 46public ImmutableSegmentedDictionary<TKey, TValue>.ValueCollection.Enumerator GetEnumerator()
ImmutableSegmentedDictionary`2+Enumerator.cs (1)
38/// <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/>.
ImmutableSegmentedDictionary`2+KeyCollection.cs (2)
15private readonly ImmutableSegmentedDictionary<TKey, TValue> _dictionary; 17internal KeyCollection(ImmutableSegmentedDictionary<TKey, TValue> dictionary)
ImmutableSegmentedDictionary`2+KeyCollection+Enumerator.cs (2)
16private ImmutableSegmentedDictionary<TKey, TValue>.Enumerator _enumerator; 18internal Enumerator(ImmutableSegmentedDictionary<TKey, TValue>.Enumerator enumerator)
ImmutableSegmentedDictionary`2+PrivateInterlocked.cs (9)
17internal static ImmutableSegmentedDictionary<TKey, TValue> VolatileRead(in ImmutableSegmentedDictionary<TKey, TValue> location) 26internal static ImmutableSegmentedDictionary<TKey, TValue> InterlockedExchange(ref ImmutableSegmentedDictionary<TKey, TValue> location, ImmutableSegmentedDictionary<TKey, TValue> value) 35internal static ImmutableSegmentedDictionary<TKey, TValue> InterlockedCompareExchange(ref ImmutableSegmentedDictionary<TKey, TValue> location, ImmutableSegmentedDictionary<TKey, TValue> value, ImmutableSegmentedDictionary<TKey, TValue> comparand)
ImmutableSegmentedDictionary`2+ValueCollection.cs (2)
15private readonly ImmutableSegmentedDictionary<TKey, TValue> _dictionary; 17internal ValueCollection(ImmutableSegmentedDictionary<TKey, TValue> dictionary)
ImmutableSegmentedDictionary`2+ValueCollection+Enumerator.cs (2)
16private ImmutableSegmentedDictionary<TKey, TValue>.Enumerator _enumerator; 18internal Enumerator(ImmutableSegmentedDictionary<TKey, TValue>.Enumerator enumerator)
RoslynImmutableInterlocked.cs (62)
152public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer) 158var oldValue = ImmutableSegmentedDictionary<TKey, TValue>.PrivateInterlocked.VolatileRead(in location); 161var newValue = transformer(oldValue); 168var interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue); 195public static bool Update<TKey, TValue, TArg>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, TArg, ImmutableSegmentedDictionary<TKey, TValue>> transformer, TArg transformerArgument) 201var oldValue = ImmutableSegmentedDictionary<TKey, TValue>.PrivateInterlocked.VolatileRead(in location); 204var newValue = transformer(oldValue, transformerArgument); 211var interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue); 228public static ImmutableSegmentedDictionary<TKey, TValue> InterlockedExchange<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, ImmutableSegmentedDictionary<TKey, TValue> value) 231return ImmutableSegmentedDictionary<TKey, TValue>.PrivateInterlocked.InterlockedExchange(ref location, value); 244public static ImmutableSegmentedDictionary<TKey, TValue> InterlockedCompareExchange<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, ImmutableSegmentedDictionary<TKey, TValue> value, ImmutableSegmentedDictionary<TKey, TValue> comparand) 247return ImmutableSegmentedDictionary<TKey, TValue>.PrivateInterlocked.InterlockedCompareExchange(ref location, value, comparand); 260public static bool InterlockedInitialize<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, ImmutableSegmentedDictionary<TKey, TValue> value) 263return InterlockedCompareExchange(ref location, value, default(ImmutableSegmentedDictionary<TKey, TValue>)).IsDefault; 267public static TValue GetOrAdd<TKey, TValue, TArg>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TArg, TValue> valueFactory, TArg factoryArgument) 273var map = ImmutableSegmentedDictionary<TKey, TValue>.PrivateInterlocked.VolatileRead(in location); 287public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory) 293var map = ImmutableSegmentedDictionary<TKey, TValue>.PrivateInterlocked.VolatileRead(in location); 307public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, TValue value) 310var priorCollection = ImmutableSegmentedDictionary<TKey, TValue>.PrivateInterlocked.VolatileRead(in location); 321var updatedCollection = priorCollection.Add(key, value); 322var interlockedResult = InterlockedCompareExchange(ref location, updatedCollection, priorCollection); 335public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory) 344var priorCollection = ImmutableSegmentedDictionary<TKey, TValue>.PrivateInterlocked.VolatileRead(in location); 359var updatedCollection = priorCollection.SetItem(key, newValue); 360var interlockedResult = InterlockedCompareExchange(ref location, updatedCollection, priorCollection); 373public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, TValue addValue, Func<TKey, TValue, TValue> updateValueFactory) 380var priorCollection = ImmutableSegmentedDictionary<TKey, TValue>.PrivateInterlocked.VolatileRead(in location); 395var updatedCollection = priorCollection.SetItem(key, newValue); 396var interlockedResult = InterlockedCompareExchange(ref location, updatedCollection, priorCollection); 409public static bool TryAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, TValue value) 412var priorCollection = ImmutableSegmentedDictionary<TKey, TValue>.PrivateInterlocked.VolatileRead(in location); 423var updatedCollection = priorCollection.Add(key, value); 424var interlockedResult = InterlockedCompareExchange(ref location, updatedCollection, priorCollection); 435public static bool TryUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, TValue newValue, TValue comparisonValue) 439var priorCollection = ImmutableSegmentedDictionary<TKey, TValue>.PrivateInterlocked.VolatileRead(in location); 451var updatedCollection = priorCollection.SetItem(key, newValue); 452var interlockedResult = InterlockedCompareExchange(ref location, updatedCollection, priorCollection); 463public static bool TryRemove<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, [MaybeNullWhen(false)] out TValue value) 466var priorCollection = ImmutableSegmentedDictionary<TKey, TValue>.PrivateInterlocked.VolatileRead(in location); 477var updatedCollection = priorCollection.Remove(key); 478var interlockedResult = InterlockedCompareExchange(ref location, updatedCollection, priorCollection);