5 instantiations of OneOrMany
Microsoft.CodeAnalysis (5)
Collections\TemporaryArray`1.cs (1)
291return new(this.ToImmutableAndClear());
DiagnosticAnalyzer\AnalysisResultBuilder.cs (1)
85value = new OneOrMany<AdditionalText>(file);
InternalUtilities\OneOrMany.cs (3)
27public static readonly OneOrMany<T> Empty = new OneOrMany<T>(ImmutableArray<T>.Empty); 165? new OneOrMany<T>(from._one) 166: new OneOrMany<T>(ImmutableArray<T>.CastUp(from._many));
48 references to OneOrMany
Microsoft.CodeAnalysis (45)
Collections\ArrayBuilderExtensions.cs (1)
259public static OneOrMany<T> ToOneOrManyAndFree<T>(this ArrayBuilder<T> builder)
Collections\ImmutableArrayExtensions.cs (3)
307public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector) 378public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector) 403public static ImmutableArray<TResult> SelectManyAsArray<TItem, TArg, TResult>(this ImmutableArray<TItem> array, Func<TItem, TArg, bool> predicate, Func<TItem, TArg, OneOrMany<TResult>> selector, TArg arg)
Collections\OrderPreservingMultiDictionary.cs (2)
157public OneOrMany<V> GetAsOneOrMany(K k) 165return OneOrMany<V>.Empty;
Collections\StaticCast.cs (3)
17internal static OneOrMany<T> From<TDerived>(OneOrMany<TDerived> from) where TDerived : class, T 19return OneOrMany<T>.CastUp(from);
Collections\TemporaryArray`1.cs (3)
277/// Create an <see cref="OneOrMany{T}"/> with the elements currently held in the temporary array, and clear the 280public OneOrMany<T> ToOneOrManyAndClear() 285return OneOrMany<T>.Empty;
DiagnosticAnalyzer\AnalysisResultBuilder.cs (7)
24private static readonly ImmutableDictionary<string, OneOrMany<AdditionalText>> s_emptyPathToAdditionalTextMap = 25ImmutableDictionary<string, OneOrMany<AdditionalText>>.Empty.WithComparers(PathUtilities.Comparer); 34private readonly ImmutableDictionary<string, OneOrMany<AdditionalText>> _pathToAdditionalTextMap; 63private static ImmutableDictionary<string, OneOrMany<AdditionalText>> CreatePathToAdditionalTextMap(ImmutableArray<AdditionalText> additionalFiles) 70var builder = ImmutableDictionary.CreateBuilder<string, OneOrMany<AdditionalText>>(PathUtilities.Comparer); 79if (builder.TryGetValue(path, out var value)) 310if (_pathToAdditionalTextMap.TryGetValue(externalFileLocation.GetLineSpan().Path, out var additionalTexts))
InternalUtilities\EnumerableExtensions.cs (1)
466public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
InternalUtilities\OneOrMany.cs (13)
24[DebuggerTypeProxy(typeof(OneOrMany<>.DebuggerProxy))] 27public static readonly OneOrMany<T> Empty = new OneOrMany<T>(ImmutableArray<T>.Empty); 93public OneOrMany<T> Add(T item) 113public OneOrMany<T> RemoveAll(T item) 123public OneOrMany<TResult> Select<TResult>(Func<T, TResult> selector) 130public OneOrMany<TResult> Select<TResult, TArg>(Func<T, TArg, TResult> selector, TArg arg) 162public static OneOrMany<T> CastUp<TDerived>(OneOrMany<TDerived> from) where TDerived : class, T 190public bool SequenceEqual(OneOrMany<T> other, IEqualityComparer<T>? comparer = null) 236private readonly OneOrMany<T> _collection; 239internal Enumerator(OneOrMany<T> collection) 254private sealed class DebuggerProxy(OneOrMany<T> instance) 256private readonly OneOrMany<T> _instance = instance;
MetadataReference\AssemblyIdentityMap.cs (5)
20private readonly Dictionary<string, OneOrMany<KeyValuePair<AssemblyIdentity, TValue>>> _map; 24_map = new Dictionary<string, OneOrMany<KeyValuePair<AssemblyIdentity, TValue>>>(AssemblyIdentityComparer.SimpleNameComparer); 35OneOrMany<KeyValuePair<AssemblyIdentity, TValue>> sameName; 78OneOrMany<KeyValuePair<AssemblyIdentity, TValue>> sameName; 102OneOrMany<KeyValuePair<AssemblyIdentity, TValue>> sameName;
SourceGeneration\Nodes\NodeStateTable.cs (5)
284public bool TryRemoveEntries(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, out OneOrMany<T> entries) 583private readonly OneOrMany<T> _items; 592public TableEntry(OneOrMany<T> items, EntryState state) 595private TableEntry(OneOrMany<T> items, ImmutableArray<EntryState> states, bool anyRemoved) 632public OneOrMany<T> Items => _items;
SourceGeneration\Nodes\PredicateSyntaxStrategy.cs (1)
72if (_filterTable.TryRemoveEntries(TimeSpan.Zero, noInputStepsStepInfo, out var removedNodes))
src\Dependencies\PooledObjects\ArrayBuilder.cs (1)
638public void AddRange(OneOrMany<T> items)
Microsoft.CodeAnalysis.CSharp (2)
Compilation\CSharpSemanticModel.cs (1)
2324var symbols = OneOrMany<Symbol>.Empty;
Compilation\MemberSemanticModel.NodeMapBuilder.cs (1)
60var nodesToAdd = additionMap.GetAsOneOrMany(key);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
SourceGeneration\StateTableTests.cs (1)
88bool didRemoveEntries = builder.TryRemoveEntries(TimeSpan.Zero, default, out var removedEntries); //((6, EntryState.Removed))