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