当前位置: 首页>>代码示例>>C#>>正文


C# INamedTypeSymbol.GetAllTypeArguments方法代码示例

本文整理汇总了C#中INamedTypeSymbol.GetAllTypeArguments方法的典型用法代码示例。如果您正苦于以下问题:C# INamedTypeSymbol.GetAllTypeArguments方法的具体用法?C# INamedTypeSymbol.GetAllTypeArguments怎么用?C# INamedTypeSymbol.GetAllTypeArguments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在INamedTypeSymbol的用法示例。


在下文中一共展示了INamedTypeSymbol.GetAllTypeArguments方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: VisitNamedType

 public override void VisitNamedType(INamedTypeSymbol namedTypeSymbol)
 {
     foreach (var argument in namedTypeSymbol.GetAllTypeArguments())
     {
         argument.Accept(this);
     }
 }
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:7,代码来源:MethodExtractor.TypeParameterCollector.cs

示例2: VisitNamedType

 public override void VisitNamedType(INamedTypeSymbol symbol)
 {
     if (_visited.Add(symbol))
     {
         foreach (var child in symbol.GetAllTypeArguments())
         {
             child.Accept(this);
         }
     }
 }
开发者ID:RoryVL,项目名称:roslyn,代码行数:10,代码来源:ITypeSymbolExtensions.CollectTypeParameterSymbolsVisitor.cs

示例3: TypeArgumentsAndParametersAreSame

            private bool TypeArgumentsAndParametersAreSame(INamedTypeSymbol symbol)
            {
                var typeArguments = symbol.GetAllTypeArguments().ToList();
                var typeParameters = symbol.GetAllTypeParameters().ToList();

                for (int i = 0; i < typeArguments.Count; i++)
                {
                    var typeArgument = typeArguments[i];
                    var typeParameter = typeParameters[i];
                    if (typeArgument is ITypeParameterSymbol && typeArgument.Name == typeParameter.Name)
                    {
                        continue;
                    }

                    return false;
                }

                return true;
            }
开发者ID:jkotas,项目名称:roslyn,代码行数:19,代码来源:AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs

示例4: AddDescriptionForNamedTypeAsync

            private async Task AddDescriptionForNamedTypeAsync(INamedTypeSymbol symbol)
            {
                if (symbol.IsAwaitableNonDynamic(_semanticModel, _position))
                {
                    AddAwaitablePrefix();
                }

                var token = await _semanticModel.SyntaxTree.GetTouchingTokenAsync(_position, this.CancellationToken).ConfigureAwait(false);
                if (token != default(SyntaxToken))
                {
                    var syntaxFactsService = this.Workspace.Services.GetLanguageServices(token.Language).GetService<ISyntaxFactsService>();
                    if (syntaxFactsService.IsAwaitKeyword(token))
                    {
                        AddPrefixTextForAwaitKeyword();
                        if (symbol.SpecialType == SpecialType.System_Void)
                        {
                            AddTextForSystemVoid();
                            return;
                        }
                    }
                }

                if (symbol.TypeKind == TypeKind.Delegate)
                {
                    var style = s_descriptionStyle.WithMiscellaneousOptions(SymbolDisplayMiscellaneousOptions.UseSpecialTypes);
                    AddToGroup(SymbolDescriptionGroups.MainDescription,
                        ToDisplayParts(symbol.OriginalDefinition, style));
                }
                else
                {
                    AddToGroup(SymbolDescriptionGroups.MainDescription,
                        ToDisplayParts(symbol.OriginalDefinition, s_descriptionStyle));
                }

                if (!symbol.IsUnboundGenericType && !TypeArgumentsAndParametersAreSame(symbol))
                {
                    var allTypeParameters = symbol.GetAllTypeParameters().ToList();
                    var allTypeArguments = symbol.GetAllTypeArguments().ToList();

                    AddTypeParameterMapPart(allTypeParameters, allTypeArguments);
                }
            }
开发者ID:jkotas,项目名称:roslyn,代码行数:42,代码来源:AbstractSymbolDisplayService.AbstractSymbolDescriptionBuilder.cs

示例5: GetCollectionElementType

            private IEnumerable<ITypeSymbol> GetCollectionElementType(INamedTypeSymbol type, int parameterIndex)
            {
                if (type != null)
                {
                    var parameters = type.GetAllTypeArguments();

                    var elementType = parameters.ElementAtOrDefault(parameterIndex);
                    if (elementType != null)
                    {
                        return SpecializedCollections.SingletonCollection(elementType);
                    }
                }

                return SpecializedCollections.EmptyEnumerable<ITypeSymbol>();
            }
开发者ID:nileshjagtap,项目名称:roslyn,代码行数:15,代码来源:CSharpTypeInferenceService.TypeInferrer.cs

示例6: VisitNamedType

            public override void VisitNamedType(INamedTypeSymbol symbol)
            {
                if (_seenTypes.Add(symbol))
                {
                    if (symbol.IsNormalAnonymousType())
                    {
                        _namedTypes.Add(symbol);

                        foreach (var property in symbol.GetValidAnonymousTypeProperties())
                        {
                            property.Accept(this);
                        }
                    }
                    else if (symbol.IsAnonymousDelegateType())
                    {
                        symbol.DelegateInvokeMethod.Accept(this);
                    }
                    else
                    {
                        foreach (var typeArgument in symbol.GetAllTypeArguments())
                        {
                            typeArgument.Accept(this);
                        }
                    }
                }
            }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:26,代码来源:AbstractAnonymousTypeDisplayService.NormalAnonymousTypeCollectorVisitor.cs


注:本文中的INamedTypeSymbol.GetAllTypeArguments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。