9 instantiations of OneOrMany
Microsoft.CodeAnalysis.Workspaces (9)
src\Dependencies\Collections\OneOrMany.cs (7)
28public static readonly OneOrMany<T> Empty = new OneOrMany<T>(ImmutableArray<T>.Empty); 166? new OneOrMany<T>(from._one) 167: new OneOrMany<T>(ImmutableArray<T>.CastUp(from._many)); 270=> new OneOrMany<T>(one); 273=> new OneOrMany<T>(ImmutableArray.Create(one, two)); 276=> one is null ? OneOrMany<T>.Empty : new OneOrMany<T>(one); 279=> new OneOrMany<T>(many);
src\Dependencies\Collections\TemporaryArray`1.cs (1)
293return new(this.ToImmutableAndClear());
Workspace\Workspace_Editor.cs (1)
809docIds = new OneOrMany<DocumentId>(id);
50 references to OneOrMany
Microsoft.CodeAnalysis.Workspaces (50)
Options\GlobalOptionService.cs (1)
147private bool SetGlobalOptions(OneOrMany<KeyValuePair<OptionKey2, object?>> options)
src\Compilers\Core\Portable\Collections\ArrayBuilderExtensions.cs (3)
15public static OneOrMany<T> ToOneOrManyAndFree<T>(this ArrayBuilder<T> builder) 19var result = OneOrMany.Create(builder[0]); 29public static void AddRange<T>(this ArrayBuilder<T> builder, OneOrMany<T> items)
src\Compilers\Core\Portable\Collections\OrderPreservingMultiDictionary.cs (2)
157public OneOrMany<V> GetAsOneOrMany(K k) 165return OneOrMany<V>.Empty;
src\Dependencies\Collections\Extensions\IEnumerableExtensions.cs (1)
481public static ImmutableArray<TResult> SelectManyAsArray<TSource, TResult>(this IEnumerable<TSource>? source, Func<TSource, OneOrMany<TResult>> selector)
src\Dependencies\Collections\Extensions\ImmutableArrayExtensions.cs (3)
308public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, OneOrMany<TResult>> selector) 379public static ImmutableArray<TResult> SelectManyAsArray<TItem, TResult>(this ImmutableArray<TItem> array, Func<TItem, bool> predicate, Func<TItem, OneOrMany<TResult>> selector) 404public static ImmutableArray<TResult> SelectManyAsArray<TItem, TArg, TResult>(this ImmutableArray<TItem> array, Func<TItem, TArg, bool> predicate, Func<TItem, TArg, OneOrMany<TResult>> selector, TArg arg)
src\Dependencies\Collections\OneOrMany.cs (20)
25[DebuggerTypeProxy(typeof(OneOrMany<>.DebuggerProxy))] 28public static readonly OneOrMany<T> Empty = new OneOrMany<T>(ImmutableArray<T>.Empty); 94public OneOrMany<T> Add(T item) 114public OneOrMany<T> RemoveAll(T item) 124public OneOrMany<TResult> Select<TResult>(Func<T, TResult> selector) 131public OneOrMany<TResult> Select<TResult, TArg>(Func<T, TArg, TResult> selector, TArg arg) 163public static OneOrMany<T> CastUp<TDerived>(OneOrMany<TDerived> from) where TDerived : class, T 191public bool SequenceEqual(OneOrMany<T> other, IEqualityComparer<T>? comparer = null) 237private readonly OneOrMany<T> _collection; 240internal Enumerator(OneOrMany<T> collection) 255private sealed class DebuggerProxy(OneOrMany<T> instance) 257private readonly OneOrMany<T> _instance = instance; 269public static OneOrMany<T> Create<T>(T one) 272public static OneOrMany<T> Create<T>(T one, T two) 275public static OneOrMany<T> OneOrNone<T>(T? one) 276=> one is null ? OneOrMany<T>.Empty : new OneOrMany<T>(one); 278public static OneOrMany<T> Create<T>(ImmutableArray<T> many) 281public static bool SequenceEqual<T>(this ImmutableArray<T> array, OneOrMany<T> other, IEqualityComparer<T>? comparer = null) 284public static bool SequenceEqual<T>(this IEnumerable<T> array, OneOrMany<T> other, IEqualityComparer<T>? comparer = null)
src\Dependencies\Collections\TemporaryArray`1.cs (4)
279/// Create an <see cref="OneOrMany{T}"/> with the elements currently held in the temporary array, and clear the 282public OneOrMany<T> ToOneOrManyAndClear() 287return OneOrMany<T>.Empty; 289var result = OneOrMany.Create(this[0]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\SymbolEquivalenceComparer.cs (1)
213private static OneOrMany<INamedTypeSymbol> Unwrap(INamedTypeSymbol namedType)
Workspace\ProjectSystem\ProjectSystemProject.cs (6)
1058var mappedPaths = GetMappedAnalyzerPaths(fullPath); 1101var mappedPaths = GetMappedAnalyzerPaths(fullPath); 1139private OneOrMany<string> GetMappedAnalyzerPaths(string fullPath) 1147return OneOrMany<string>.Empty; 1217private OneOrMany<string> GetMappedRazorSourceGenerator(string fullPath) 1231return OneOrMany<string>.Empty;
Workspace\Solution\TextDocumentStates.cs (6)
29using FilePathToDocumentIds = ReadOnlyDictionary<string, OneOrMany<DocumentId>>; 48new(new Dictionary<string, OneOrMany<DocumentId>>())); 334if (_filePathToDocumentIds.TryGetValue(filePath, out var oneOrMany)) 347return _filePathToDocumentIds.TryGetValue(filePath, out var oneOrMany) 358var result = new Dictionary<string, OneOrMany<DocumentId>>(SolutionState.FilePathComparer); 367result[filePath] = result.TryGetValue(filePath, out var existingValue)
Workspace\Workspace_Editor.cs (3)
35private readonly Dictionary<SourceTextContainer, OneOrMany<DocumentId>> _bufferToAssociatedDocumentsMap = []; 798if (_bufferToAssociatedDocumentsMap.TryGetValue(textContainer, out var docIds)) 824if (!_bufferToAssociatedDocumentsMap.TryGetValue(textContainer, out var docIds))