4 instantiations of ImmutableSegmentedDictionary
Microsoft.CodeAnalysis (4)
src\Dependencies\Collections\ImmutableSegmentedDictionary`2.cs (2)
73public static readonly ImmutableSegmentedDictionary<TKey, TValue> Empty = new(new SegmentedDictionary<TKey, TValue>()); 283return new ImmutableSegmentedDictionary<TKey, TValue>(new SegmentedDictionary<TKey, TValue>(keyComparer));
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (1)
51=> dictionary is not null ? new ImmutableSegmentedDictionary<TKey, TValue>(dictionary) : default;
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueBuilder.cs (1)
229_dictionary = new ImmutableSegmentedDictionary<TKey, TValue>(ReadOnlyDictionary);
240 references to ImmutableSegmentedDictionary
Microsoft.CodeAnalysis (227)
Collections\DictionaryExtensions.cs (1)
91public static ImmutableSegmentedDictionary<K, ImmutableArray<V>> ToImmutableSegmentedDictionaryAndFree<K, V>(this IReadOnlyDictionary<K, ArrayBuilder<V>> builder)
DiagnosticAnalyzer\AnalyzerDriver.cs (12)
156private ImmutableSegmentedDictionary<DiagnosticAnalyzer, SemaphoreSlim> _lazyAnalyzerGateMap; 157private ImmutableSegmentedDictionary<DiagnosticAnalyzer, SemaphoreSlim> AnalyzerGateMap 166private ImmutableSegmentedDictionary<DiagnosticAnalyzer, GeneratedCodeAnalysisFlags> _lazyGeneratedCodeAnalysisFlagsMap; 171private ImmutableSegmentedDictionary<DiagnosticAnalyzer, GeneratedCodeAnalysisFlags> GeneratedCodeAnalysisFlagsMap 383_lazyAnalyzerGateMap = ImmutableSegmentedDictionary<DiagnosticAnalyzer, SemaphoreSlim>.Empty; 566ImmutableSegmentedDictionary<DiagnosticAnalyzer, GeneratedCodeAnalysisFlags> generatedCodeAnalysisFlagsMap, 583private static bool ComputeShouldTreatAllCodeAsNonGeneratedCode(ImmutableHashSet<DiagnosticAnalyzer> analyzers, ImmutableSegmentedDictionary<DiagnosticAnalyzer, GeneratedCodeAnalysisFlags> generatedCodeAnalysisFlagsMap) 604ImmutableSegmentedDictionary<DiagnosticAnalyzer, GeneratedCodeAnalysisFlags> generatedCodeAnalysisFlagsMap, 2224private static async Task<ImmutableSegmentedDictionary<DiagnosticAnalyzer, SemaphoreSlim>> CreateAnalyzerGateMapAsync( 2249private static async Task<ImmutableSegmentedDictionary<DiagnosticAnalyzer, GeneratedCodeAnalysisFlags>> CreateGeneratedCodeAnalysisFlagsMapAsync( 2616var nodeActionsByKind = groupedActionsForAnalyzer.NodeActionsByAnalyzerAndKind; 2745var operationActionsByKind = groupedActionsForAnalyzer.OperationActionsByAnalyzerAndKind;
DiagnosticAnalyzer\AnalyzerDriver.GroupedAnalyzerActionsForAnalyzer.cs (6)
19private ImmutableSegmentedDictionary<TLanguageKindEnum, ImmutableArray<SyntaxNodeAnalyzerAction<TLanguageKindEnum>>> _lazyNodeActionsByKind; 20private ImmutableSegmentedDictionary<OperationKind, ImmutableArray<OperationAnalyzerAction>> _lazyOperationActionsByKind; 67public ImmutableSegmentedDictionary<TLanguageKindEnum, ImmutableArray<SyntaxNodeAnalyzerAction<TLanguageKindEnum>>> NodeActionsByAnalyzerAndKind 79ImmutableSegmentedDictionary<TLanguageKindEnum, ImmutableArray<SyntaxNodeAnalyzerAction<TLanguageKindEnum>>>.Empty; 87public ImmutableSegmentedDictionary<OperationKind, ImmutableArray<OperationAnalyzerAction>> OperationActionsByAnalyzerAndKind 97ImmutableSegmentedDictionary<OperationKind, ImmutableArray<OperationAnalyzerAction>>.Empty;
DiagnosticAnalyzer\AnalyzerExecutor.cs (10)
851var executableNodeActionsByKind = GetNodeActionsByKind(syntaxNodeActions); 857var operationActionsByKind = GetOperationActionsByKind(operationActions); 924internal static ImmutableSegmentedDictionary<TLanguageKindEnum, ImmutableArray<SyntaxNodeAnalyzerAction<TLanguageKindEnum>>> GetNodeActionsByKind<TLanguageKindEnum>( 945var map = ImmutableSegmentedDictionary.CreateRange(tuples); 955ImmutableSegmentedDictionary<TLanguageKindEnum, ImmutableArray<SyntaxNodeAnalyzerAction<TLanguageKindEnum>>> nodeActionsByKind, 982ImmutableSegmentedDictionary<TLanguageKindEnum, ImmutableArray<SyntaxNodeAnalyzerAction<TLanguageKindEnum>>> nodeActionsByKind, 1025internal static ImmutableSegmentedDictionary<OperationKind, ImmutableArray<OperationAnalyzerAction>> GetOperationActionsByKind(IEnumerable<OperationAnalyzerAction> operationActions) 1044var map = ImmutableSegmentedDictionary.CreateRange(tuples); 1058ImmutableSegmentedDictionary<OperationKind, ImmutableArray<OperationAnalyzerAction>> operationActionsByKind, 1083ImmutableSegmentedDictionary<OperationKind, ImmutableArray<OperationAnalyzerAction>> operationActionsByKind,
Emit\EditAndContinue\EmitBaseline.cs (2)
193synthesizedMembers: ImmutableSegmentedDictionary<ISymbolInternal, ImmutableArray<ISymbolInternal>>.Empty, 194deletedMembers: ImmutableSegmentedDictionary<ISymbolInternal, ImmutableArray<ISymbolInternal>>.Empty,
Emit\EditAndContinue\SymbolChanges.cs (1)
470elementSelector: static e => e.Value.ToImmutableAndFree()) ?? ImmutableSegmentedDictionary<ISymbolInternal, ImmutableArray<ISymbolInternal>>.Empty;
Emit\EditAndContinue\SymbolMatcher.cs (3)
108private ImmutableSegmentedDictionary<AnonymousTypeKey, AnonymousTypeValue> MapAnonymousTypes(IReadOnlyDictionary<AnonymousTypeKey, AnonymousTypeValue> anonymousTypeMap) 122private ImmutableSegmentedDictionary<SynthesizedDelegateKey, SynthesizedDelegateValue> MapAnonymousDelegates(IReadOnlyDictionary<SynthesizedDelegateKey, SynthesizedDelegateValue> anonymousDelegates) 136private ImmutableSegmentedDictionary<AnonymousDelegateWithIndexedNamePartialKey, ImmutableArray<AnonymousTypeValue>> MapAnonymousDelegatesWithIndexedNames(
Emit\EditAndContinue\SynthesizedTypeMaps.cs (9)
11ImmutableSegmentedDictionary<AnonymousTypeKey, AnonymousTypeValue>? anonymousTypeMap, 12ImmutableSegmentedDictionary<SynthesizedDelegateKey, SynthesizedDelegateValue>? anonymousDelegates, 13ImmutableSegmentedDictionary<AnonymousDelegateWithIndexedNamePartialKey, ImmutableArray<AnonymousTypeValue>>? anonymousDelegatesWithIndexedNames) 23public ImmutableSegmentedDictionary<AnonymousTypeKey, AnonymousTypeValue> AnonymousTypes { get; } 24= anonymousTypeMap ?? ImmutableSegmentedDictionary<AnonymousTypeKey, AnonymousTypeValue>.Empty; 30public ImmutableSegmentedDictionary<SynthesizedDelegateKey, SynthesizedDelegateValue> AnonymousDelegates { get; } 31= anonymousDelegates ?? ImmutableSegmentedDictionary<SynthesizedDelegateKey, SynthesizedDelegateValue>.Empty; 37public ImmutableSegmentedDictionary<AnonymousDelegateWithIndexedNamePartialKey, ImmutableArray<AnonymousTypeValue>> AnonymousDelegatesWithIndexedNames { get; } 38= anonymousDelegatesWithIndexedNames ?? ImmutableSegmentedDictionary<AnonymousDelegateWithIndexedNamePartialKey, ImmutableArray<AnonymousTypeValue>>.Empty;
SourceGeneration\Nodes\StateTableStore.cs (4)
12private readonly ImmutableSegmentedDictionary<object, IStateTable> _tables; 14public static readonly StateTableStore Empty = new StateTableStore(ImmutableSegmentedDictionary<object, IStateTable>.Empty); 16private StateTableStore(ImmutableSegmentedDictionary<object, IStateTable> tables) 39private readonly ImmutableSegmentedDictionary<object, IStateTable>.Builder _tableBuilder = ImmutableSegmentedDictionary.CreateBuilder<object, IStateTable>();
src\Dependencies\Collections\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)
src\Dependencies\Collections\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) 170public ImmutableSegmentedDictionary<TKey, TValue> Clear() 172var self = this; 196public ImmutableSegmentedDictionary<TKey, TValue> Remove(TKey key) 198var self = this; 207public ImmutableSegmentedDictionary<TKey, TValue> RemoveRange(IEnumerable<TKey> keys) 217public ImmutableSegmentedDictionary<TKey, TValue> SetItem(TKey key, TValue value) 219var self = this; 230public ImmutableSegmentedDictionary<TKey, TValue> SetItems(IEnumerable<KeyValuePair<TKey, TValue>> items) 246var self = this; 265public ImmutableSegmentedDictionary<TKey, TValue> WithComparer(IEqualityComparer<TKey>? keyComparer) 269var self = this; 303return obj is ImmutableSegmentedDictionary<TKey, TValue> other 307public bool Equals(ImmutableSegmentedDictionary<TKey, TValue> other) 372private static bool TryCastToImmutableSegmentedDictionary(IEnumerable<KeyValuePair<TKey, TValue>> pairs, out ImmutableSegmentedDictionary<TKey, TValue> other) 374if (pairs is ImmutableSegmentedDictionary<TKey, TValue> dictionary) 380if (pairs is ImmutableSegmentedDictionary<TKey, TValue>.Builder builder)
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder.cs (2)
22internal Builder(ImmutableSegmentedDictionary<TKey, TValue> dictionary) 120public ImmutableSegmentedDictionary<TKey, TValue> ToImmutable()
src\Dependencies\Collections\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()
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Builder+PrivateMarshal.cs (1)
16/// <inheritdoc cref="SegmentedCollectionsMarshal.GetValueRefOrNullRef{TKey, TValue}(ImmutableSegmentedDictionary{TKey, TValue}.Builder, TKey)"/>
src\Dependencies\Collections\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()
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+Enumerator.cs (1)
38/// <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/>.
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+KeyCollection.cs (2)
15private readonly ImmutableSegmentedDictionary<TKey, TValue> _dictionary; 17internal KeyCollection(ImmutableSegmentedDictionary<TKey, TValue> dictionary)
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+KeyCollection+Enumerator.cs (2)
16private ImmutableSegmentedDictionary<TKey, TValue>.Enumerator _enumerator; 18internal Enumerator(ImmutableSegmentedDictionary<TKey, TValue>.Enumerator enumerator)
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+PrivateMarshal.cs (14)
18internal static ImmutableSegmentedDictionary<TKey, TValue> VolatileRead(in ImmutableSegmentedDictionary<TKey, TValue> location) 27internal static ImmutableSegmentedDictionary<TKey, TValue> InterlockedExchange(ref ImmutableSegmentedDictionary<TKey, TValue> location, ImmutableSegmentedDictionary<TKey, TValue> value) 36internal static ImmutableSegmentedDictionary<TKey, TValue> InterlockedCompareExchange(ref ImmutableSegmentedDictionary<TKey, TValue> location, ImmutableSegmentedDictionary<TKey, TValue> value, ImmutableSegmentedDictionary<TKey, TValue> comparand) 45/// <inheritdoc cref="SegmentedCollectionsMarshal.GetValueRefOrNullRef{TKey, TValue}(ImmutableSegmentedDictionary{TKey, TValue}, TKey)"/> 46public static ref readonly TValue FindValue(ImmutableSegmentedDictionary<TKey, TValue> dictionary, TKey key) 50internal static ImmutableSegmentedDictionary<TKey, TValue> AsImmutableSegmentedDictionary(SegmentedDictionary<TKey, TValue>? dictionary) 53/// <inheritdoc cref="SegmentedCollectionsMarshal.AsSegmentedDictionary{TKey, TValue}(ImmutableSegmentedDictionary{TKey, TValue})"/> 54internal static SegmentedDictionary<TKey, TValue>? AsSegmentedDictionary(ImmutableSegmentedDictionary<TKey, TValue> dictionary)
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueBuilder.cs (4)
19private ImmutableSegmentedDictionary<TKey, TValue> _dictionary; 27internal ValueBuilder(ImmutableSegmentedDictionary<TKey, TValue> dictionary) 98var originalDictionary = RoslynImmutableInterlocked.InterlockedExchange(ref _dictionary, default); 227public ImmutableSegmentedDictionary<TKey, TValue> ToImmutable()
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueCollection.cs (2)
15private readonly ImmutableSegmentedDictionary<TKey, TValue> _dictionary; 17internal ValueCollection(ImmutableSegmentedDictionary<TKey, TValue> dictionary)
src\Dependencies\Collections\ImmutableSegmentedDictionary`2+ValueCollection+Enumerator.cs (2)
16private ImmutableSegmentedDictionary<TKey, TValue>.Enumerator _enumerator; 18internal Enumerator(ImmutableSegmentedDictionary<TKey, TValue>.Enumerator enumerator)
src\Dependencies\Collections\RoslynImmutableInterlocked.cs (62)
274public static bool Update<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, ImmutableSegmentedDictionary<TKey, TValue>> transformer) 280var oldValue = ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.VolatileRead(in location); 283var newValue = transformer(oldValue); 290var interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue); 317public static bool Update<TKey, TValue, TArg>(ref ImmutableSegmentedDictionary<TKey, TValue> location, Func<ImmutableSegmentedDictionary<TKey, TValue>, TArg, ImmutableSegmentedDictionary<TKey, TValue>> transformer, TArg transformerArgument) 323var oldValue = ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.VolatileRead(in location); 326var newValue = transformer(oldValue, transformerArgument); 333var interlockedResult = InterlockedCompareExchange(ref location, newValue, oldValue); 350public static ImmutableSegmentedDictionary<TKey, TValue> InterlockedExchange<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, ImmutableSegmentedDictionary<TKey, TValue> value) 353return ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.InterlockedExchange(ref location, value); 366public static ImmutableSegmentedDictionary<TKey, TValue> InterlockedCompareExchange<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, ImmutableSegmentedDictionary<TKey, TValue> value, ImmutableSegmentedDictionary<TKey, TValue> comparand) 369return ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.InterlockedCompareExchange(ref location, value, comparand); 382public static bool InterlockedInitialize<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, ImmutableSegmentedDictionary<TKey, TValue> value) 385return InterlockedCompareExchange(ref location, value, default(ImmutableSegmentedDictionary<TKey, TValue>)).IsDefault; 389public static TValue GetOrAdd<TKey, TValue, TArg>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TArg, TValue> valueFactory, TArg factoryArgument) 395var map = ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.VolatileRead(in location); 409public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> valueFactory) 415var map = ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.VolatileRead(in location); 429public static TValue GetOrAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, TValue value) 432var priorCollection = ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.VolatileRead(in location); 443var updatedCollection = priorCollection.Add(key, value); 444var interlockedResult = InterlockedCompareExchange(ref location, updatedCollection, priorCollection); 457public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, Func<TKey, TValue> addValueFactory, Func<TKey, TValue, TValue> updateValueFactory) 466var priorCollection = ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.VolatileRead(in location); 481var updatedCollection = priorCollection.SetItem(key, newValue); 482var interlockedResult = InterlockedCompareExchange(ref location, updatedCollection, priorCollection); 495public static TValue AddOrUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, TValue addValue, Func<TKey, TValue, TValue> updateValueFactory) 502var priorCollection = ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.VolatileRead(in location); 517var updatedCollection = priorCollection.SetItem(key, newValue); 518var interlockedResult = InterlockedCompareExchange(ref location, updatedCollection, priorCollection); 531public static bool TryAdd<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, TValue value) 534var priorCollection = ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.VolatileRead(in location); 545var updatedCollection = priorCollection.Add(key, value); 546var interlockedResult = InterlockedCompareExchange(ref location, updatedCollection, priorCollection); 557public static bool TryUpdate<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, TValue newValue, TValue comparisonValue) 561var priorCollection = ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.VolatileRead(in location); 573var updatedCollection = priorCollection.SetItem(key, newValue); 574var interlockedResult = InterlockedCompareExchange(ref location, updatedCollection, priorCollection); 585public static bool TryRemove<TKey, TValue>(ref ImmutableSegmentedDictionary<TKey, TValue> location, TKey key, [MaybeNullWhen(false)] out TValue value) 588var priorCollection = ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.VolatileRead(in location); 599var updatedCollection = priorCollection.Remove(key); 600var interlockedResult = InterlockedCompareExchange(ref location, updatedCollection, priorCollection);
src\Dependencies\Collections\SegmentedCollectionsMarshal.cs (24)
62/// Gets either a read-only ref to a <typeparamref name="TValue"/> in the <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> 73public static ref readonly TValue GetValueRefOrNullRef<TKey, TValue>(ImmutableSegmentedDictionary<TKey, TValue> dictionary, TKey key) 75=> ref ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.FindValue(dictionary, key); 78/// Gets either a ref to a <typeparamref name="TValue"/> in the <see cref="ImmutableSegmentedDictionary{TKey, TValue}.Builder"/> 86/// Items should not be added or removed from the <see cref="ImmutableSegmentedDictionary{TKey, TValue}.Builder"/> 91public static ref TValue GetValueRefOrNullRef<TKey, TValue>(ImmutableSegmentedDictionary<TKey, TValue>.Builder dictionary, TKey key) 93=> ref ImmutableSegmentedDictionary<TKey, TValue>.Builder.PrivateMarshal.FindValue(dictionary, key); 180/// Gets an <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> value wrapping the input <see cref="SegmentedDictionary{TKey, TValue}"/>. 184/// <param name="dictionary">The input segmented dictionary to wrap in the returned <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> value.</param> 185/// <returns>An <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> value wrapping <paramref name="dictionary"/>.</returns> 189/// dictionary, and that it won't be modified once the returned <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> 191/// of a given <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> values to change after its creation. 194/// If <paramref name="dictionary"/> is <see langword="null"/>, the returned <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> 195/// value will be uninitialized (i.e. its <see cref="ImmutableSegmentedDictionary{TKey, TValue}.IsDefault"/> 199public static ImmutableSegmentedDictionary<TKey, TValue> AsImmutableSegmentedDictionary<TKey, TValue>(SegmentedDictionary<TKey, TValue>? dictionary) 201=> ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.AsImmutableSegmentedDictionary(dictionary); 204/// Gets the underlying <see cref="SegmentedDictionary{TKey, TValue}"/> for an input <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> value. 206/// <typeparam name="TKey">The type of keys in the input <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> value.</typeparam> 207/// <typeparam name="TValue">The type of values in the input <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> value.</typeparam> 208/// <param name="dictionary">The input <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> value to get the underlying <see cref="SegmentedDictionary{TKey, TValue}"/> from.</param> 214/// don't expect the contents of the <see cref="ImmutableSegmentedDictionary{TKey, TValue}"/> value to change. 217/// If <paramref name="dictionary"/> is uninitialized (i.e. its <see cref="ImmutableSegmentedDictionary{TKey, TValue}.IsDefault"/> 221public static SegmentedDictionary<TKey, TValue>? AsSegmentedDictionary<TKey, TValue>(ImmutableSegmentedDictionary<TKey, TValue> dictionary) 223=> ImmutableSegmentedDictionary<TKey, TValue>.PrivateMarshal.AsSegmentedDictionary(dictionary);
Syntax\SyntaxNodeExtensions_Tracking.cs (1)
196private readonly ImmutableSegmentedDictionary<SyntaxAnnotation, IReadOnlyList<SyntaxNode>> _idToNodeMap;
Microsoft.CodeAnalysis.CSharp (1)
Symbols\NamedTypeSymbol.cs (1)
32/// <see langword="default"/> if uninitialized. <see cref="RequiredMembersErrorSentinel"/> if there are errors. <see cref="ImmutableSegmentedDictionary{TKey, TValue}.Empty"/> if
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (5)
Emit\EditAndContinue\SymbolMatcherTests.cs (5)
485var anonymousTypeMap0 = synthesizedTypes0.AnonymousTypes; 555var anonymousTypeMap0 = synthesizedTypes0.AnonymousTypes; 1110var anonymousTypeMap0 = synthesizedTypes0.AnonymousTypes; 1463var synthesizedDelegates0 = synthesizedTypes0.AnonymousDelegates; 1531var anonymousDelegates0 = synthesizedTypes0.AnonymousDelegatesWithIndexedNames;
Microsoft.CodeAnalysis.UnitTests (4)
Collections\ImmutableSegmentedDictionaryBuilderTest.cs (2)
57var set = ImmutableSegmentedDictionary<int, string>.Empty.Add(1, "1"); 126var collection = ImmutableSegmentedDictionary<int, string?>.Empty.Add(1, null);
Collections\ImmutableSegmentedDictionaryTest.cs (2)
39var map = Empty<string, string>(StringComparer.Ordinal) 54var map = Empty<string, string>(StringComparer.Ordinal)
Microsoft.CodeAnalysis.VisualBasic (3)
Symbols\NamedTypeSymbol.vb (3)
31''' <see cref="ImmutableSegmentedDictionary(Of String, Symbol).Empty"/> if there are no required members. Otherwise, 1102''' this will be <see cref="ImmutableSegmentedDictionary(Of String, Symbol).Empty"/>. 1114''' true, <see cref="AllRequiredMembers"/> will be <see cref="ImmutableSegmentedDictionary(Of String, Symbol).Empty"/>