本文整理汇总了C#中INamedTypeSymbol.GetAllTypeParameters方法的典型用法代码示例。如果您正苦于以下问题:C# INamedTypeSymbol.GetAllTypeParameters方法的具体用法?C# INamedTypeSymbol.GetAllTypeParameters怎么用?C# INamedTypeSymbol.GetAllTypeParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类INamedTypeSymbol
的用法示例。
在下文中一共展示了INamedTypeSymbol.GetAllTypeParameters方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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
示例2: 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
示例3: EnsureNonConflictingNames
public static IMethodSymbol EnsureNonConflictingNames(
this IMethodSymbol method, INamedTypeSymbol containingType, CancellationToken cancellationToken)
{
// The method's type parameters may conflict with the type parameters in the type
// we're generating into. In that case, rename them.
var parameterNames = NameGenerator.EnsureUniqueness(
method.Parameters.Select(p => p.Name).ToList(), isCaseSensitive: true);
var outerTypeParameterNames =
containingType.GetAllTypeParameters()
.Select(tp => tp.Name)
.Concat(method.Name)
.Concat(containingType.Name);
var unusableNames = parameterNames.Concat(outerTypeParameterNames).ToSet(StringComparer.Ordinal);
var newTypeParameterNames = NameGenerator.EnsureUniqueness(
method.TypeParameters.Select(tp => tp.Name).ToList(),
n => !unusableNames.Contains(n));
var updatedMethod = method.RenameTypeParameters(newTypeParameterNames);
return updatedMethod.RenameParameters(parameterNames);
}