5 implementations of TypeArguments
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
89public abstract ImmutableArray<ITypeSymbol> TypeArguments { get; }
Microsoft.CodeAnalysis.CSharp (1)
Symbols\PublicModel\NamedTypeSymbol.cs (1)
72ImmutableArray<ITypeSymbol> INamedTypeSymbol.TypeArguments
Microsoft.CodeAnalysis.Features (1)
MetadataAsSource\AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs (1)
79public ImmutableArray<ITypeSymbol> TypeArguments => _symbol.TypeArguments;
Microsoft.CodeAnalysis.VisualBasic (1)
Symbols\NamedTypeSymbol.vb (1)
1375Private ReadOnly Property INamedTypeSymbol_TypeArguments As ImmutableArray(Of ITypeSymbol) Implements INamedTypeSymbol.TypeArguments
Microsoft.CodeAnalysis.Workspaces (1)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\Symbols\CodeGenerationAbstractNamedTypeSymbol.cs (1)
89public abstract ImmutableArray<ITypeSymbol> TypeArguments { get; }
299 references to TypeArguments
ConfigurationSchemaGenerator (8)
RuntimeSource\Configuration.Binder\ConfigurationBindingGenerator.Parser.cs (6)
225underlyingType = genericType.TypeArguments[0]; 544type = ((INamedTypeSymbol)type).TypeArguments[0]; // extract the T from a Nullable<T> 759elementType = candidate.TypeArguments[0]; 773keyType = candidate.TypeArguments[0]; 774elementType = candidate.TypeArguments[1]; 839foreach (ITypeSymbol typeArg in genericType.TypeArguments)
RuntimeSource\SourceGenerators\TypeModelHelper.cs (2)
31if (!current.TypeArguments.IsEmpty) 33(args ??= new()).AddRange(current.TypeArguments);
ILLink.RoslynAnalyzer (4)
RequiresAnalyzerBase.cs (1)
75 typeArgs = typeSymbol.TypeArguments;
TrimAnalysis\GenericArgumentDataFlow.cs (2)
18 ProcessGenericArgumentDataFlow (location, type.TypeArguments, type.TypeParameters, reportDiagnostic); 65 foreach (var typeArgument in type.TypeArguments) {
TrimAnalysis\SingleValueExtensions.cs (1)
17 var underlyingType = (type as INamedTypeSymbol)?.TypeArguments.FirstOrDefault ();
Microsoft.Analyzers.Extra (3)
CallAnalysis\Arrays.cs (3)
107var keyType = type.TypeArguments[0]; 123if (type.TypeArguments.Length == 2) 125valueType = type.TypeArguments[1];
Microsoft.AspNetCore.App.Analyzers (8)
Http\RequestDelegateReturnTypeAnalyzer.cs (1)
81((INamedTypeSymbol)returnType).TypeArguments[0].ToString()));
RouteHandlers\DisallowNonParsableComplexTypesOnParameters.cs (1)
133parameterTypeSymbol = parameterTypeSymbol.TypeArguments[0] as INamedTypeSymbol;
RouteHandlers\DisallowReturningActionResultFromMapMethods.cs (2)
91if (returnType is not INamedTypeSymbol { Name: "Task" or "ValueTask", IsGenericType: true, TypeArguments: { Length: 1 } } taskLike) 96return taskLike.TypeArguments[0];
src\Shared\RoslynUtils\ParsabilityHelper.cs (3)
131SymbolEqualityComparer.Default.Equals(constructedTypeSymbol.TypeArguments[0].UnwrapTypeSymbol(unwrapNullable: true), typeSymbol); 142SymbolEqualityComparer.Default.Equals(returnType.TypeArguments[0], typeSymbol); 159SymbolEqualityComparer.Default.Equals(returnType.TypeArguments[0].UnwrapTypeSymbol(unwrapNullable: true), containingType);
src\Shared\RoslynUtils\SymbolExtensions.cs (1)
36unwrappedTypeSymbol = unwrappedTypeSymbol.TypeArguments[0] as INamedTypeSymbol;
Microsoft.AspNetCore.Http.RequestDelegateGenerator (8)
src\Shared\RoslynUtils\ParsabilityHelper.cs (3)
131SymbolEqualityComparer.Default.Equals(constructedTypeSymbol.TypeArguments[0].UnwrapTypeSymbol(unwrapNullable: true), typeSymbol); 142SymbolEqualityComparer.Default.Equals(returnType.TypeArguments[0], typeSymbol); 159SymbolEqualityComparer.Default.Equals(returnType.TypeArguments[0].UnwrapTypeSymbol(unwrapNullable: true), containingType);
src\Shared\RoslynUtils\SymbolExtensions.cs (1)
36unwrappedTypeSymbol = unwrappedTypeSymbol.TypeArguments[0] as INamedTypeSymbol;
StaticRouteHandlerModel\Emitters\DiagnosticEmitter.cs (2)
35((INamedTypeSymbol)typeSymbol).TypeArguments.Any(a => a is ITypeParameterSymbol)) 42((INamedTypeSymbol)typeSymbol).TypeArguments.Any(typeArg =>
StaticRouteHandlerModel\EndpointResponse.cs (1)
58return ((INamedTypeSymbol)returnType).TypeArguments[0];
StaticRouteHandlerModel\Model\EndpointParameterExtensions.cs (1)
55=> ((INamedTypeSymbol?)parameter.BindableMethodSymbol?.ReturnType)?.TypeArguments[0];
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (4)
HubServerProxyGenerator.Parser.cs (4)
280methodSpec.InnerReturnTypeName = rtype.TypeArguments[0].ToString(); 284&& a.TypeArguments[0] is INamedTypeSymbol { Arity: 1, Name: "ChannelReader" } b) 287methodSpec.InnerReturnTypeName = b.TypeArguments[0].ToString(); 292methodSpec.InnerReturnTypeName = c.TypeArguments[0].ToString();
Microsoft.CodeAnalysis (7)
DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (1)
566return TypeInfo.Create(containingType.TypeArguments[i]);
DocumentationCommentId.cs (3)
594else if (symbol.TypeArguments.Length > 0) 598for (int i = 0, n = symbol.TypeArguments.Length; i < n; i++) 605this.Visit(symbol.TypeArguments[i]);
Operations\ControlFlowGraphBuilder.cs (1)
3130((INamedTypeSymbol)operation.Target.Type!).TypeArguments[0].Equals(operation.Type))
Symbols\INamedTypeSymbol.cs (1)
91/// The modifiers correspond to the type argument at the same ordinal within the <see cref="TypeArguments"/>
Symbols\ITypeSymbol.cs (1)
216return ((INamedTypeSymbol)type).TypeArguments[0];
Microsoft.CodeAnalysis.CodeStyle (26)
src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
79return typeofOperation.TypeOperand is INamedTypeSymbol namedType && namedType.TypeArguments.Length == 0;
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
104collectionElementType = ienumerableOfT.TypeArguments[0];
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (1)
566return TypeInfo.Create(containingType.TypeArguments[i]);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (1)
39return stack.SelectMany(n => n.TypeArguments);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
391INamedTypeSymbol nt => nt.TypeArguments,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (1)
188foreach (var typeArg in type.TypeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.AnonymousTypeRemover.cs (2)
46var arguments = symbol.TypeArguments.Select(t => t.Accept(this)).ToArray(); 47if (arguments.SequenceEqual(symbol.TypeArguments))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (4)
73underlyingType = ((INamedTypeSymbol)symbol).TypeArguments[0]; 421var typeArgument = ((INamedTypeSymbol)typeSymbol).TypeArguments[0]; 750TypeArguments.Length: 1, 758TypeArguments.Length: 1,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.MinimalAccessibilityVisitor.cs (1)
52foreach (var arg in symbol.TypeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.SubstituteTypesVisitor.cs (2)
86var substitutedArguments = symbol.TypeArguments.Select(t => t.Accept(this)); 87if (symbol.TypeArguments.SequenceEqual(substitutedArguments))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnavailableTypeParameterRemover.cs (2)
42var arguments = symbol.TypeArguments.Select(t => t.Accept(this)).ToArray(); 43if (arguments.SequenceEqual(symbol.TypeArguments))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnnamedErrorTypeRemover.cs (2)
46var arguments = symbol.TypeArguments.Select(t => t.Accept(this)).ToArray(); 47if (arguments.SequenceEqual(symbol.TypeArguments))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
46/// the "same" <see cref="INamedTypeSymbol.TypeArguments"/>.</item>
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (1)
41visitor.WriteSymbolKeyArray(symbol.TypeArguments);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamedTypeSymbolKey.cs (1)
31visitor.WriteSymbolKeyArray(symbol.TypeArguments);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (3)
69return AreEquivalent(array.ElementType, readOnlySpanType.TypeArguments.Single(), equivalentTypesWithDifferingAssemblies); 415TypeArgumentsAreEquivalent(x.TypeArguments, y.TypeArguments, equivalentTypesWithDifferingAssemblies);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
187: CombineHashCodes(x.TypeArguments, currentHash, _symbolAggregator);
Microsoft.CodeAnalysis.CodeStyle.Fixes (4)
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (1)
52foreach (var typeArg in symbol.TypeArguments)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (1)
203foreach (var genericParam in namedType.TypeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
186? factory.GenericName(classOrStructType.Name, classOrStructType.TypeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (1)
111var parameters = type.TypeArguments;
Microsoft.CodeAnalysis.CSharp (4)
SymbolDisplay\SymbolDisplayVisitor.Types.cs (4)
223var typeArg = symbol.TypeArguments[0]; 414AddTypeParameterConstraints(symbol.TypeArguments); 499tupleSymbol = (INamedTypeSymbol)currentUnderlying.TypeArguments[NamedTypeSymbol.ValueTupleRestPosition - 1]; 790typeArguments = ((INamedTypeSymbol)owner).TypeArguments;
Microsoft.CodeAnalysis.CSharp.CodeStyle (7)
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
109semanticModel.Compilation, ienumerableType.TypeArguments.Single()))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
1017TypeArguments: [ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method }] 1083TypeArguments: [ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method }]
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (4)
595if (namedCastedType.TypeArguments.Length != 1 && originalNamedConvertedType.TypeArguments.Length != 1) 598if (!originalNamedConvertedType.TypeArguments[0].Equals(namedCastedType.TypeArguments[0], SymbolEqualityComparer.IncludeNullability))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (12)
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
67namedType.TypeArguments[0].SpecialType == SpecialType.System_Byte;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (3)
204? Enumerable.Repeat((TypeSyntax)OmittedTypeArgument(), symbol.TypeArguments.Length) 205: symbol.TypeArguments.SelectAsArray(t => t.GenerateTypeSyntax()); 239var innerType = symbol.TypeArguments.First();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (8)
690if (inferredNamedType.TypeArguments.Length == returnNamedType.TypeArguments.Length) 692for (int i = 0, n = inferredNamedType.TypeArguments.Length; i < n; i++) 694DetermineTypeParameterMapping(inferredNamedType.TypeArguments[i], returnNamedType.TypeArguments[i], result); 1978return memberType is INamedTypeSymbol namedType && namedType.TypeArguments.Length == 1 1979? [new TypeInferenceInfo(namedType.TypeArguments[0])] 1993return namedTypeSymbol.TypeArguments[0];
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
CodeGen\CodeGenTupleTest.cs (2)
14317Assert.False(m4TupleList.TypeArguments[0].IsTupleType); 14327Assert.True(m4TupleList.TypeArguments[0].IsTupleType);
Microsoft.CodeAnalysis.CSharp.Features (6)
Completion\CompletionProviders\DeclarationName\DeclarationNameRecommender.cs (2)
122if (type is IErrorTypeSymbol { TypeArguments: [var typeArgument] } && 167return UnwrapType(namedType.TypeArguments[0], compilation, wasPlural: wasPlural, seenTypes: seenTypes);
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\CSharpUseCollectionExpressionForArrayDiagnosticAnalyzer.cs (1)
109semanticModel.Compilation, ienumerableType.TypeArguments.Single()))
src\Analyzers\CSharp\Analyzers\UseCollectionExpression\UseCollectionExpressionHelpers.cs (2)
1017TypeArguments: [ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method }] 1083TypeArguments: [ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method }]
src\Analyzers\CSharp\CodeFixes\UseUtf8StringLiteral\UseUtf8StringLiteralCodeFixProvider.cs (1)
67namedType.TypeArguments[0].SpecialType == SpecialType.System_Byte;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (7)
Semantics\DeconstructionTests.cs (4)
4273Assert.Equal(TypeKind.Error, ((INamedTypeSymbol)typeInfo.Type).TypeArguments[0].TypeKind); 4274Assert.Equal(TypeKind.Error, ((INamedTypeSymbol)typeInfo.Type).TypeArguments[1].TypeKind); 4532Assert.Equal(TypeKind.Error, ((INamedTypeSymbol)typeInfo.Type).TypeArguments[0].TypeKind); 4533Assert.Equal(TypeKind.Error, ((INamedTypeSymbol)typeInfo.Type).TypeArguments[1].TypeKind);
Semantics\NativeIntegerTests.cs (3)
288for (int i = 0; i < underlyingInterface.TypeArguments.Length; i++) 290var underlyingTypeArgument = underlyingInterface.TypeArguments[i]; 291var nativeIntegerTypeArgument = nativeIntegerInterface.TypeArguments[i];
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (24)
Compilation\GetSemanticInfoTests.cs (3)
4117Assert.Equal(SpecialType.System_Int32, ((INamedTypeSymbol)info0.Symbol).TypeArguments.Single().SpecialType); 4125Assert.Equal(SpecialType.System_Int32, ((INamedTypeSymbol)info2.Symbol).TypeArguments.Single().SpecialType); 4176Assert.Equal(SpecialType.System_Int32, ((INamedTypeSymbol)info2.Symbol).TypeArguments.Single().SpecialType);
Compilation\SemanticModelAPITests.cs (1)
623Assert.Equal(bt, at2.TypeArguments.First());
Compilation\SemanticModelGetSemanticInfoTests.cs (3)
9269Assert.True(type.TypeArguments[0].IsErrorType()); 9274Assert.Equal(constructedFrom.TypeArguments[0], constructedFrom.TypeParameters[0]); 9277Assert.False(constructedFrom.TypeArguments[0].IsErrorType());
Compilation\SymbolVisitorTests.cs (9)
121VisitChildren(symbol.TypeArguments); 128if (symbol.TypeArguments.Length > 0) 131VisitChildren(symbol.TypeArguments); 301VisitChildren(symbol.TypeArguments); 308if (symbol.TypeArguments.Length > 0) 311VisitChildren(symbol.TypeArguments); 423VisitChildren(symbol.TypeArguments, argument); 430if (symbol.TypeArguments.Length > 0) 433VisitChildren(symbol.TypeArguments, argument);
DocumentationComments\CrefTests.cs (4)
3014actualJ = (ITypeParameterSymbol)actualTypeA.TypeArguments.Single(); 3026actualK = (ITypeParameterSymbol)actualTypeB.TypeArguments.Single(); 5563var crefTypeParam = referencedType.TypeArguments.Single(); 6540Assert.Equal(TypeKind.Error, ((INamedTypeSymbol)actualSymbol1).TypeArguments.Single().TypeKind);
Symbols\CustomModifiersTests.cs (2)
78var i = (INamedTypeSymbol)type.TypeArguments.First(); 154var i = type.TypeArguments.First();
Symbols\Source\NullablePublicAPITests.cs (1)
892var result = ((INamedTypeSymbol)method.ReturnType).TypeArguments.Single().NullableAnnotation;
Symbols\TypeTests.cs (1)
1862Assert.IsType<UnboundArgumentErrorTypeSymbol>(symbol.ContainingType.TypeArguments.Single().GetSymbol());
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Extensions.cs (1)
874return type.TypeArguments.Select(t => t.NullableAnnotation);
Microsoft.CodeAnalysis.CSharp.Workspaces (19)
Simplification\CSharpSimplificationService.Expander.cs (2)
844if (namedTypedSymbol.TypeArguments.Length != 0) 846foreach (var typeArgument in namedTypedSymbol.TypeArguments)
Simplification\Simplifiers\ExpressionSimplifier.cs (1)
423if (rightSymbol.ContainingType is { TypeArguments.Length: 0 } containingType &&
Simplification\Simplifiers\NameSimplifier.cs (1)
442var argument = type.TypeArguments.SingleOrDefault();
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\Simplification\Simplifiers\CastSimplifier.cs (4)
595if (namedCastedType.TypeArguments.Length != 1 && originalNamedConvertedType.TypeArguments.Length != 1) 598if (!originalNamedConvertedType.TypeArguments[0].Equals(namedCastedType.TypeArguments[0], SymbolEqualityComparer.IncludeNullability))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\Extensions\ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs (3)
204? Enumerable.Repeat((TypeSyntax)OmittedTypeArgument(), symbol.TypeArguments.Length) 205: symbol.TypeArguments.SelectAsArray(t => t.GenerateTypeSyntax()); 239var innerType = symbol.TypeArguments.First();
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\LanguageServices\CSharpTypeInferenceService.TypeInferrer.cs (8)
690if (inferredNamedType.TypeArguments.Length == returnNamedType.TypeArguments.Length) 692for (int i = 0, n = inferredNamedType.TypeArguments.Length; i < n; i++) 694DetermineTypeParameterMapping(inferredNamedType.TypeArguments[i], returnNamedType.TypeArguments[i], result); 1978return memberType is INamedTypeSymbol namedType && namedType.TypeArguments.Length == 1 1979? [new TypeInferenceInfo(namedType.TypeArguments[0])] 1993return namedTypeSymbol.TypeArguments[0];
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
AbstractTypeParameterChecker.cs (1)
123foreach (var typeArgument in symbol.TypeArguments)
Microsoft.CodeAnalysis.Features (13)
Debugging\AbstractBreakpointResolver.cs (1)
166(nameAndArity.Arity == 0 || nameAndArity.Arity == typeSymbol.TypeArguments.Length);
ExtractMethod\MethodExtractor.Analyzer.cs (1)
253returnType = ((INamedTypeSymbol)returnType).TypeArguments[0];
FullyQualify\AbstractFullyQualifyService.cs (1)
241if (looksGeneric && searchResult.TypeArguments.Length == 0)
GenerateComparisonOperators\GenerateComparisonOperatorsCodeRefactoringProvider.cs (2)
77var comparedType = iface.TypeArguments[0]; 184var comparedType = comparableType.TypeArguments[0];
MetadataAsSource\AbstractMetadataAsSourceService.WrappedNamedTypeSymbol.cs (1)
79public ImmutableArray<ITypeSymbol> TypeArguments => _symbol.TypeArguments;
QuickInfo\CommonSemanticQuickInfoProvider.ErrorVisitor.cs (1)
61foreach (var typeParameter in symbol.TypeArguments.Concat(symbol.TypeParameters))
RQName\RQNodeBuilder.cs (1)
324foreach (var typeArgument in entry.TypeArguments)
src\Analyzers\Core\Analyzers\ConvertTypeofToNameof\AbstractConvertTypeOfToNameOfDiagnosticAnalyzer.cs (1)
79return typeofOperation.TypeOperand is INamedTypeSymbol namedType && namedType.TypeArguments.Length == 0;
src\Analyzers\Core\Analyzers\ForEachCast\AbstractForEachCastDiagnosticAnalyzer.cs (1)
104collectionElementType = ienumerableOfT.TypeArguments[0];
src\Analyzers\Core\CodeFixes\GenerateParameterizedMember\TypeParameterSubstitution.cs (1)
52foreach (var typeArg in symbol.TypeArguments)
src\Analyzers\Core\CodeFixes\ImplementInterface\ImplementHelpers.cs (1)
203foreach (var genericParam in namedType.TypeArguments)
src\Compilers\Core\Portable\DiagnosticAnalyzer\SuppressMessageAttributeState.TargetSymbolResolver.cs (1)
566return TypeInfo.Create(containingType.TypeArguments[i]);
Microsoft.CodeAnalysis.VisualBasic (4)
SymbolDisplay\SymbolDisplayVisitor.Types.vb (3)
101symbol.TypeArguments(0).Accept(Me.NotFirstVisitor()) 297AddTypeArguments(symbol.TypeArguments, symbol) 354tupleSymbol = DirectCast(currentUnderlying.TypeArguments(TupleTypeSymbol.RestPosition - 1), INamedTypeSymbol)
Symbols\NamedTypeSymbol.vb (1)
1375Private ReadOnly Property INamedTypeSymbol_TypeArguments As ImmutableArray(Of ITypeSymbol) Implements INamedTypeSymbol.TypeArguments
Microsoft.CodeAnalysis.VisualBasic.CodeStyle.Fixes (5)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (1)
48Return GenerateExpression(generator, DirectCast(type, INamedTypeSymbol).TypeArguments(0), value, canUseFieldReference)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeSyntaxGeneratorVisitor.vb (2)
82Return AddInformationTo(SyntaxFactory.NullableType(symbol.TypeArguments.First().Accept(Me)), symbol) 91SyntaxFactory.TypeArgumentList(SyntaxFactory.SeparatedList(symbol.TypeArguments.[Select](Function(t) t.Accept(Me)))))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (2)
512Return New TypeInferenceInfo(DirectCast(t.InferredType, INamedTypeSymbol).TypeArguments(0)) 776Return CreateResult(DirectCast(memberType, INamedTypeSymbol).TypeArguments(0))
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (2)
SymbolsTests\CustomModifiersTests.vb (2)
74Dim i = DirectCast(type.TypeArguments.First(), INamedTypeSymbol) 148Dim i = type.TypeArguments.First()
Microsoft.CodeAnalysis.VisualBasic.Workspaces (7)
Simplification\Simplifiers\ExpressionSimplifier.vb (1)
254containingType.TypeArguments.Length <> 0 Then
Simplification\Simplifiers\NameSimplifier.vb (1)
446Dim argument = type.TypeArguments.SingleOrDefault()
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\CodeGeneration\ExpressionGenerator.vb (1)
48Return GenerateExpression(generator, DirectCast(type, INamedTypeSymbol).TypeArguments(0), value, canUseFieldReference)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\Extensions\TypeSyntaxGeneratorVisitor.vb (2)
82Return AddInformationTo(SyntaxFactory.NullableType(symbol.TypeArguments.First().Accept(Me)), symbol) 91SyntaxFactory.TypeArgumentList(SyntaxFactory.SeparatedList(symbol.TypeArguments.[Select](Function(t) t.Accept(Me)))))
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\LanguageServices\VisualBasicTypeInferenceService.TypeInferrer.vb (2)
512Return New TypeInferenceInfo(DirectCast(t.InferredType, INamedTypeSymbol).TypeArguments(0)) 776Return CreateResult(DirectCast(memberType, INamedTypeSymbol).TypeArguments(0))
Microsoft.CodeAnalysis.Workspaces (26)
ObsoleteSymbol\AbstractObsoleteSymbolService.cs (1)
200if (symbol is INamedTypeSymbol { OriginalDefinition.SpecialType: SpecialType.System_Nullable_T, TypeArguments: [var valueType] })
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\INamedTypeSymbolExtensions.cs (1)
39return stack.SelectMany(n => n.TypeArguments);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions.cs (1)
391INamedTypeSymbol nt => nt.TypeArguments,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ISymbolExtensions_Accessibility.cs (1)
188foreach (var typeArg in type.TypeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.AnonymousTypeRemover.cs (2)
46var arguments = symbol.TypeArguments.Select(t => t.Accept(this)).ToArray(); 47if (arguments.SequenceEqual(symbol.TypeArguments))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.cs (4)
73underlyingType = ((INamedTypeSymbol)symbol).TypeArguments[0]; 421var typeArgument = ((INamedTypeSymbol)typeSymbol).TypeArguments[0]; 750TypeArguments.Length: 1, 758TypeArguments.Length: 1,
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.MinimalAccessibilityVisitor.cs (1)
52foreach (var arg in symbol.TypeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.SubstituteTypesVisitor.cs (2)
86var substitutedArguments = symbol.TypeArguments.Select(t => t.Accept(this)); 87if (symbol.TypeArguments.SequenceEqual(substitutedArguments))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnavailableTypeParameterRemover.cs (2)
42var arguments = symbol.TypeArguments.Select(t => t.Accept(this)).ToArray(); 43if (arguments.SequenceEqual(symbol.TypeArguments))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ITypeSymbolExtensions.UnnamedErrorTypeRemover.cs (2)
46var arguments = symbol.TypeArguments.Select(t => t.Accept(this)).ToArray(); 47if (arguments.SequenceEqual(symbol.TypeArguments))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.cs (1)
46/// the "same" <see cref="INamedTypeSymbol.TypeArguments"/>.</item>
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.ErrorTypeSymbolKey.cs (1)
41visitor.WriteSymbolKeyArray(symbol.TypeArguments);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\SymbolKey\SymbolKey.NamedTypeSymbolKey.cs (1)
31visitor.WriteSymbolKeyArray(symbol.TypeArguments);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.EquivalenceVisitor.cs (3)
69return AreEquivalent(array.ElementType, readOnlySpanType.TypeArguments.Single(), equivalentTypesWithDifferingAssemblies); 415TypeArgumentsAreEquivalent(x.TypeArguments, y.TypeArguments, equivalentTypesWithDifferingAssemblies);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SymbolEquivalenceComparer.GetHashCodeVisitor.cs (1)
187: CombineHashCodes(x.TypeArguments, currentHash, _symbolAggregator);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\SyntaxGeneratorExtensions.cs (1)
186? factory.GenericName(classOrStructType.Name, classOrStructType.TypeArguments)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\LanguageServices\TypeInferenceService\AbstractTypeInferenceService.AbstractTypeInferrer.cs (1)
111var parameters = type.TypeArguments;
Microsoft.CodeAnalysis.Workspaces.UnitTests (1)
UtilityTest\DocumentationCommentIdTests.cs (1)
339var ienumTP = ienum.Construct(outerType.TypeArguments[0]);
Microsoft.Extensions.Options.SourceGeneration (10)
Parser.cs (9)
216foreach (var ta in mt.TypeArguments) 245type = ((INamedTypeSymbol)type).TypeArguments[0]; 251return ((INamedTypeSymbol)type).TypeArguments[0]; 259return implementingInterface.TypeArguments.First(); 273modelType = ((INamedTypeSymbol)modelType).TypeArguments[0]; 639typeSymbol = ((INamedTypeSymbol)typeSymbol).TypeArguments[0]; 690mt = ((INamedTypeSymbol)mt).TypeArguments[0]; 754result.Add(implementingInterface.TypeArguments.First()); 767var t = implementingInterface.TypeArguments.First();
ParserUtilities.cs (1)
78type = ((INamedTypeSymbol)type).TypeArguments[0]; // extract the T from a Nullable<T>
Microsoft.Gen.Logging (7)
Parsing\Parser.cs (1)
568extractedType = ((INamedTypeSymbol)paramTypeSymbol).TypeArguments[0];
Parsing\Parser.LogProperties.cs (4)
46paramTypeSymbol = ((INamedTypeSymbol)paramTypeSymbol).TypeArguments[0]; 187extractedType = ((INamedTypeSymbol)extractedType).TypeArguments[0]; 274extractedType = ((INamedTypeSymbol)extractedType).TypeArguments[0]; 344symType = ((INamedTypeSymbol)symType).TypeArguments[0];
Parsing\Parser.Records.cs (1)
130extractedType = ((INamedTypeSymbol)memberType).TypeArguments[0];
Parsing\TypeSymbolExtensions.cs (1)
97return namedTypeSymbol.TypeArguments[0];
Microsoft.Gen.Metrics (2)
Parser.cs (2)
213=> symbol.TypeArguments.IsDefaultOrEmpty 215: symbol.TypeArguments[0];
Microsoft.Gen.MetricsReports (2)
src\Generators\Microsoft.Gen.Metrics\Parser.cs (2)
213=> symbol.TypeArguments.IsDefaultOrEmpty 215: symbol.TypeArguments[0];
Microsoft.Interop.ComInterfaceGenerator (1)
VtableIndexStubGenerator.cs (1)
305var unwrapperSyntax = ParseTypeName(unmanagedObjectUnwrapper.AttributeClass.TypeArguments[0].ToDisplayString());
Microsoft.Interop.JavaScript.JSImportGenerator (11)
JSManagedTypeInfo.cs (9)
103if (CreateJSTypeInfoForTypeSymbol(nullable.TypeArguments[0]) is JSSimpleTypeInfo uti) 120case INamedTypeSymbol { TypeArguments.Length: 1 } taskType when fullTypeName.StartsWith(Constants.TaskGlobal, StringComparison.Ordinal): 121if (CreateJSTypeInfoForTypeSymbol(taskType.TypeArguments[0]) is JSSimpleTypeInfo rti) 128case INamedTypeSymbol { TypeArguments.Length: 1 } spanType when fullTypeName.StartsWith(Constants.SpanGlobal, StringComparison.Ordinal): 129if (CreateJSTypeInfoForTypeSymbol(spanType.TypeArguments[0]) is JSSimpleTypeInfo sti) 136case INamedTypeSymbol { TypeArguments.Length: 1 } arraySegmentType when fullTypeName.StartsWith(Constants.ArraySegmentGlobal, StringComparison.Ordinal): 137if (CreateJSTypeInfoForTypeSymbol(arraySegmentType.TypeArguments[0]) is JSSimpleTypeInfo gti) 147var argumentTypes = actionType.TypeArguments 158var signatureTypes = funcType.TypeArguments
JSMarshalAsAttributeInfoParser.cs (2)
26INamedTypeSymbol? jsTypeArgs = attributeData.AttributeClass.TypeArguments[0] as INamedTypeSymbol; 35foreach (var ta in jsTypeArgs.TypeArguments.Cast<INamedTypeSymbol>().Select(x => x.ToDisplayString()))
Microsoft.Interop.LibraryImportGenerator (6)
Analyzers\CustomMarshallerAttributeAnalyzer.cs (2)
992allocatedBufferType.TypeArguments[0].ToDisplayString()); 1000elementType = ((INamedTypeSymbol)spanTypeMaybe).TypeArguments[0];
Analyzers\CustomMarshallerAttributeFixer.cs (4)
389return ((INamedTypeSymbol)methods.ManagedValuesSource.ReturnType).TypeArguments[0]; 393return ((INamedTypeSymbol)methods.ManagedValuesDestination.ReturnType).TypeArguments[0]; 556return ((INamedTypeSymbol)methods.ManagedValuesSource.ReturnType).TypeArguments[0]; 560return ((INamedTypeSymbol)methods.ManagedValuesDestination.ReturnType).TypeArguments[0];
Microsoft.Interop.SourceGeneration (13)
ArrayMarshallingInfoProvider.cs (1)
70arrayMarshaller.TypeArguments.Last());
CustomMarshallingInfoHelper.cs (1)
56entryPointType.TypeArguments.Last());
ManualTypeMarshallingHelper.cs (7)
383ITypeSymbol resultType = entryType.TypeArguments[0]; 467collectionElementType = ((INamedTypeSymbol)methods.ManagedValuesSource.ReturnType).TypeArguments[0]; 498collectionElementType = ((INamedTypeSymbol)methods.ManagedValuesDestination.ReturnType).TypeArguments[0]; 525bufferElementType = ManagedTypeInfo.CreateTypeInfoForTypeSymbol(((INamedTypeSymbol)methods.ToUnmanagedWithBuffer.Parameters[1].Type).TypeArguments[0]); 573collectionElementType = ((INamedTypeSymbol)methods.ManagedValuesSource.ReturnType).TypeArguments[0]; 591collectionElementType = ((INamedTypeSymbol)methods.ManagedValuesDestination.ReturnType).TypeArguments[0]; 605bufferElementType = ManagedTypeInfo.CreateTypeInfoForTypeSymbol(((INamedTypeSymbol)methods.FromManagedWithBuffer.Parameters[1].Type).TypeArguments[0]);
MarshallerShape.cs (3)
228if (!SymbolEqualityComparer.Default.Equals(spanOfT, namedType.ConstructedFrom) || namedType.TypeArguments.Length != 1) 231ITypeSymbol typeArgument = namedType.TypeArguments[0]; 242&& SymbolEqualityComparer.Default.Equals(currentType.TypeArguments[i], typeArgument))
TypeSymbolExtensions.cs (1)
312genericTypesToSubstitute.Push((instantiatedType.TypeArguments, instantiatedType.TypeArgumentNullableAnnotations));
Microsoft.VisualStudio.LanguageServices (4)
Library\VsNavInfo\NavInfoFactory.cs (1)
79typeSymbol = ((INamedTypeSymbol)typeSymbol).TypeArguments[0];
Progression\GraphNodeIdCreation.cs (3)
187var hasGenericArguments = (!Equals(namedType.ConstructedFrom, namedType) || isInGenericArguments) && namedType.TypeArguments != null && namedType.TypeArguments.Any(); 192foreach (var arg in namedType.TypeArguments)
System.Text.Json.SourceGeneration (28)
Helpers\RoslynExtensions.cs (2)
81ImmutableArray<ITypeSymbol> typeArguments = namedType.TypeArguments; 205elementType = ((INamedTypeSymbol)type).TypeArguments[0];
JsonSourceGenerator.Parser.cs (24)
758valueType = ((INamedTypeSymbol)type).TypeArguments[0]; 766valueType = ((INamedTypeSymbol)type).TypeArguments[0]; 774valueType = iAsyncEnumerableType.TypeArguments[0]; 794valueType = actualTypeToConvert.TypeArguments[1]; 799valueType = actualTypeToConvert.TypeArguments[0]; 804keyType = actualTypeToConvert.TypeArguments[0]; 805valueType = actualTypeToConvert.TypeArguments[1]; 810ImmutableArray<ITypeSymbol> genericArgs = ((INamedTypeSymbol)type).TypeArguments; 817keyType = actualTypeToConvert.TypeArguments[0]; 818valueType = actualTypeToConvert.TypeArguments[1]; 824keyType = actualTypeToConvert.TypeArguments[0]; 825valueType = actualTypeToConvert.TypeArguments[1]; 831valueType = ((INamedTypeSymbol)type).TypeArguments[0]; 836valueType = actualTypeToConvert.TypeArguments[0]; 841valueType = actualTypeToConvert.TypeArguments[0]; 846valueType = actualTypeToConvert.TypeArguments[0]; 851valueType = actualTypeToConvert.TypeArguments[0]; 856valueType = actualTypeToConvert.TypeArguments[0]; 861valueType = actualTypeToConvert.TypeArguments[0]; 866valueType = actualTypeToConvert.TypeArguments[0]; 871valueType = actualTypeToConvert.TypeArguments[0]; 1107return SymbolEqualityComparer.Default.Equals(actualDictionaryType.TypeArguments[0], _knownSymbols.StringType) && 1108(SymbolEqualityComparer.Default.Equals(actualDictionaryType.TypeArguments[1], _knownSymbols.ObjectType) || 1109SymbolEqualityComparer.Default.Equals(actualDictionaryType.TypeArguments[1], _knownSymbols.JsonElementType));
src\libraries\Common\src\SourceGenerators\TypeModelHelper.cs (2)
31if (!current.TypeArguments.IsEmpty) 33(args ??= new()).AddRange(current.TypeArguments);
System.Windows.Forms.Analyzers.CSharp (1)
System\Windows\Forms\CSharp\Analyzers\AvoidPassingTaskWithoutCancellationToken\AvoidPassingTaskWithoutCancellationTokenAnalyzer.cs (1)
50|| funcType.TypeArguments.Length != 1
System.Windows.Forms.Analyzers.VisualBasic (1)
Analyzers\AvoidPassingTaskWithoutCancellationToken\AvoidPassingTaskWithoutCancellationTokenAnalyzer.vb (1)
60If funcType.TypeArguments.Length <> 1 OrElse funcType.ContainingNamespace.ToString() <> "System" Then