97 references to OneOrMany
Microsoft.CodeAnalysis (10)
InternalUtilities\OneOrMany.cs (4)
131
OneOrMany
.Create(selector(_one)) :
132
OneOrMany
.Create(_many.SelectAsArray(selector));
138
OneOrMany
.Create(selector(_one, arg)) :
139
OneOrMany
.Create(_many.SelectAsArray(selector, arg));
MetadataReference\AssemblyIdentityMap.cs (1)
103
_map[identity.Name] = _map.TryGetValue(identity.Name, out sameName) ? sameName.Add(pair) :
OneOrMany
.Create(pair);
SourceGeneration\Nodes\NodeStateTable.cs (5)
258
_states.Add(new TableEntry(
OneOrMany
.Create(chosen), state));
359
_states.Add(new TableEntry(
OneOrMany
.Create(value), state));
365
var tableEntry = new TableEntry(
OneOrMany
.Create(values), state);
636
items =
OneOrMany
.Create(item);
640
items =
OneOrMany
.Create(_items.ToImmutableAndFree());
Microsoft.CodeAnalysis.CSharp (34)
Symbols\Source\FieldSymbolWithAttributesAndModifiers.cs (1)
89
if (LoadAndValidateAttributes(
OneOrMany
.Create(this.AttributeDeclarationSyntaxList), ref _lazyCustomAttributesBag))
Symbols\Source\LambdaParameterSymbol.cs (1)
45
internal override OneOrMany<SyntaxList<AttributeListSyntax>> GetAttributeDeclarations() =>
OneOrMany
.Create(_attributeLists);
Symbols\Source\LambdaSymbol.cs (1)
273
OneOrMany
.Create(lambdaSyntax.AttributeLists) :
Symbols\Source\LocalFunctionSymbol.cs (1)
314
return
OneOrMany
.Create(Syntax.AttributeLists);
Symbols\Source\SourceAssemblySymbol.cs (3)
1560
LoadAndValidateAttributes(
OneOrMany
.Create(GetAttributeDeclarations()), ref _lazySourceAttributesBag))
1668
LoadAndValidateAttributes(
OneOrMany
.Create(GetAttributeDeclarations()), ref attributesBag, attributeMatchesOpt: attributeMatches);
1719
OneOrMany
.Create(GetAttributeDeclarations()), ref attributesBag,
Symbols\Source\SourceComplexParameterSymbol.cs (4)
503
return
OneOrMany
.Create(attributes);
521
return
OneOrMany
.Create(otherAttributes);
525
return
OneOrMany
.Create(attributes);
528
return
OneOrMany
.Create(ImmutableArray.Create(attributes, otherAttributes));
Symbols\Source\SourceConstructorSymbol.cs (1)
163
return
OneOrMany
.Create(((ConstructorDeclarationSyntax)this.SyntaxNode).AttributeLists);
Symbols\Source\SourceConstructorSymbolBase.cs (1)
175
return
OneOrMany
.Create(default(SyntaxList<AttributeListSyntax>));
Symbols\Source\SourceCustomEventAccessorSymbol.cs (1)
82
return
OneOrMany
.Create(GetSyntax().AttributeLists);
Symbols\Source\SourceDelegateMethodSymbol.cs (3)
206
return
OneOrMany
.Create(((SourceNamedTypeSymbol)ContainingSymbol).GetAttributeDeclarations());
242
return
OneOrMany
.Create(default(SyntaxList<AttributeListSyntax>));
401
return
OneOrMany
.Create(default(SyntaxList<AttributeListSyntax>));
Symbols\Source\SourceDestructorSymbol.cs (2)
156
return
OneOrMany
.Create(this.GetSyntax().AttributeLists);
162
return
OneOrMany
.Create(default(SyntaxList<AttributeListSyntax>));
Symbols\Source\SourceEventSymbol.cs (1)
186
LoadAndValidateAttributes(
OneOrMany
.Create(this.AttributeDeclarationSyntaxList), ref _lazyCustomAttributesBag))
Symbols\Source\SourceMethodSymbolWithAttributes.cs (1)
168
return
OneOrMany
.Create(default(SyntaxList<AttributeListSyntax>));
Symbols\Source\SourceModuleSymbol.cs (1)
465
if (LoadAndValidateAttributes(
OneOrMany
.Create(mergedAttributes), ref _lazyCustomAttributesBag))
Symbols\Source\SourceNamedTypeSymbol.cs (1)
846
if (LoadAndValidateAttributes(
OneOrMany
.Create(this.GetAttributeDeclarations()), ref _lazyCustomAttributesBag))
Symbols\Source\SourceOrdinaryMethodSymbol.cs (2)
497
return
OneOrMany
.Create(ImmutableArray.Create(AttributeDeclarationSyntaxList, this.SourcePartialImplementation.AttributeDeclarationSyntaxList));
501
return
OneOrMany
.Create(AttributeDeclarationSyntaxList);
Symbols\Source\SourcePropertyAccessorSymbol.cs (1)
641
return
OneOrMany
.Create(((AccessorDeclarationSyntax)syntax).AttributeLists);
Symbols\Source\SourcePropertySymbolBase.cs (2)
397
LoadAndValidateAttributes(
OneOrMany
.Create(indexerNameAttributeLists), ref temp, earlyDecodingOnly: true);
1060
if (LoadAndValidateAttributes(
OneOrMany
.Create(AttributeDeclarationSyntaxList), ref _lazyCustomAttributesBag))
Symbols\Source\SourceTypeParameterSymbol.cs (1)
186
OneOrMany
.Create(this.MergedAttributeDeclarationSyntaxLists),
Symbols\Source\SourceUserDefinedConversionSymbol.cs (1)
124
return
OneOrMany
.Create(this.GetSyntax().AttributeLists);
Symbols\Source\SourceUserDefinedOperatorSymbol.cs (1)
124
return
OneOrMany
.Create(this.GetSyntax().AttributeLists);
Symbols\Synthesized\Records\SynthesizedRecordEqualityOperatorBase.cs (1)
54
internal sealed override OneOrMany<SyntaxList<AttributeListSyntax>> GetAttributeDeclarations() =>
OneOrMany
.Create(default(SyntaxList<AttributeListSyntax>));
Symbols\Synthesized\Records\SynthesizedRecordOrdinaryMethod.cs (1)
77
internal sealed override OneOrMany<SyntaxList<AttributeListSyntax>> GetAttributeDeclarations() =>
OneOrMany
.Create(default(SyntaxList<AttributeListSyntax>));
Symbols\Synthesized\SynthesizedEventAccessorSymbol.cs (1)
63
return
OneOrMany
.Create(this.AssociatedEvent.AttributeDeclarationSyntaxList);
Microsoft.CodeAnalysis.UnitTests (35)
InternalUtilities\OneOrManyTests.cs (35)
37
Verify(
OneOrMany
.Create(ImmutableArray<int>.Empty));
44
Verify(
OneOrMany
.Create(1), 1);
45
Verify(
OneOrMany
.Create(ImmutableArray.Create(2)), 2);
46
Verify(
OneOrMany
.Create(ImmutableArray<int>.Empty).Add(3), 3);
55
Verify(
OneOrMany
.Create(ImmutableArray.Create(1, 2, 3)).Add(4), 1, 2, 3, 4);
56
Verify(
OneOrMany
.Create(ImmutableArray.Create(1, 2, 3, 4)), 1, 2, 3, 4);
57
Verify(
OneOrMany
.Create(ImmutableArray<int>.Empty).Add(1).Add(2).Add(3).Add(4), 1, 2, 3, 4);
61
Verify(
OneOrMany
.Create(ImmutableArray.Create(1)).Add(4), 1, 4);
62
Verify(
OneOrMany
.Create(ImmutableArray.Create(1)), 1);
68
Assert.True(
OneOrMany
.Create(1).Contains(1));
69
Assert.False(
OneOrMany
.Create(1).Contains(0));
71
Assert.False(
OneOrMany
.Create(ImmutableArray<int>.Empty).Contains(0));
73
Assert.True(
OneOrMany
.Create(ImmutableArray.Create(1)).Contains(1));
74
Assert.False(
OneOrMany
.Create(ImmutableArray.Create(1)).Contains(0));
76
Assert.True(
OneOrMany
.Create(ImmutableArray.Create(1, 2)).Contains(1));
77
Assert.True(
OneOrMany
.Create(ImmutableArray.Create(1, 2)).Contains(2));
78
Assert.False(
OneOrMany
.Create(ImmutableArray.Create(1, 2)).Contains(0));
84
Verify(
OneOrMany
.Create(1).Select(i => i + 1), 2);
85
Verify(
OneOrMany
.Create(ImmutableArray<int>.Empty).Select(i => i + 1));
86
Verify(
OneOrMany
.Create(ImmutableArray.Create(1)).Select(i => i + 1), 2);
87
Verify(
OneOrMany
.Create(ImmutableArray.Create(1, 2)).Select(i => i + 1), 2, 3);
93
Verify(
OneOrMany
.Create(1).Select((i, a) => i + a, 1), 2);
94
Verify(
OneOrMany
.Create(ImmutableArray<int>.Empty).Select((i, a) => i + a, 1));
95
Verify(
OneOrMany
.Create(ImmutableArray.Create(1)).Select((i, a) => i + a, 1), 2);
96
Verify(
OneOrMany
.Create(ImmutableArray.Create(1, 2)).Select((i, a) => i + a, 1), 2, 3);
102
Assert.Equal(1,
OneOrMany
.Create(1).FirstOrDefault(i => i < 2));
103
Assert.Equal(0,
OneOrMany
.Create(1).FirstOrDefault(i => i > 2));
104
Assert.Equal(0,
OneOrMany
.Create(ImmutableArray<int>.Empty).FirstOrDefault(i => i > 2));
105
Assert.Equal(1,
OneOrMany
.Create(ImmutableArray.Create(1)).FirstOrDefault(i => i < 2));
106
Assert.Equal(0,
OneOrMany
.Create(ImmutableArray.Create(1)).FirstOrDefault(i => i > 2));
107
Assert.Equal(1,
OneOrMany
.Create(ImmutableArray.Create(1, 3)).FirstOrDefault(i => i < 2));
108
Assert.Equal(3,
OneOrMany
.Create(ImmutableArray.Create(1, 3)).FirstOrDefault(i => i > 2));
114
var single =
OneOrMany
.Create(123);
115
var quad =
OneOrMany
.Create(ImmutableArray.Create<int>(10, 20, 30, 40));
121
Assert.Throws<ArgumentNullException>(() =>
OneOrMany
.Create(default(ImmutableArray<int>)));
Microsoft.CodeAnalysis.VisualBasic (18)
Symbols\Source\CustomEventAccessorSymbol.vb (1)
127
Return
OneOrMany
.Create(AttributeDeclarationSyntaxList)
Symbols\Source\SourceAssemblySymbol.vb (1)
798
LoadAndValidateAttributes(
OneOrMany
.Create(GetAttributeDeclarations()), _lazySourceAttributesBag)
Symbols\Source\SourceComplexParameterSymbol.vb (4)
66
Return
OneOrMany
.Create(attributes)
80
Return
OneOrMany
.Create(otherAttributes)
82
Return
OneOrMany
.Create(attributes)
84
Return
OneOrMany
.Create(ImmutableArray.Create(attributes, otherAttributes))
Symbols\Source\SourceEnumConstantSymbol.vb (1)
53
Return
OneOrMany
.Create(DirectCast(Syntax, EnumMemberDeclarationSyntax).AttributeLists)
Symbols\Source\SourceEventSymbol.vb (1)
619
LoadAndValidateAttributes(
OneOrMany
.Create(Me.AttributeDeclarationSyntaxList), _lazyCustomAttributesBag)
Symbols\Source\SourceMemberFieldSymbol.vb (1)
44
Return
OneOrMany
.Create(DirectCast(Syntax.Parent.Parent, FieldDeclarationSyntax).AttributeLists)
Symbols\Source\SourceMemberMethodSymbol.vb (2)
143
Return
OneOrMany
.Create(ImmutableArray.Create(AttributeDeclarationSyntaxList, Me.SourcePartialImplementation.AttributeDeclarationSyntaxList))
145
Return
OneOrMany
.Create(AttributeDeclarationSyntaxList)
Symbols\Source\SourceMethodSymbol.vb (2)
1376
Return
OneOrMany
.Create(AttributeDeclarationSyntaxList)
1380
Return
OneOrMany
.Create(ReturnTypeAttributeDeclarationSyntaxList)
Symbols\Source\SourceModuleSymbol.vb (1)
241
LoadAndValidateAttributes(
OneOrMany
.Create(mergedAttributes), _lazyCustomAttributesBag)
Symbols\Source\SourceNamedTypeSymbol.vb (1)
1837
LoadAndValidateAttributes(
OneOrMany
.Create(GetAttributeDeclarations()), m_lazyCustomAttributesBag)
Symbols\Source\SourcePropertyAccessorSymbol.vb (1)
355
Return
OneOrMany
.Create(AttributeDeclarationSyntaxList)
Symbols\Source\SourcePropertySymbol.vb (2)
476
Return
OneOrMany
.Create(DirectCast(_syntaxRef.GetSyntax, PropertyStatementSyntax).AttributeLists)
489
Return
OneOrMany
.Create(asClauseOpt.Attributes)