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