本文整理汇总了C#中IPropertySymbol.GetTypeArguments方法的典型用法代码示例。如果您正苦于以下问题:C# IPropertySymbol.GetTypeArguments方法的具体用法?C# IPropertySymbol.GetTypeArguments怎么用?C# IPropertySymbol.GetTypeArguments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertySymbol
的用法示例。
在下文中一共展示了IPropertySymbol.GetTypeArguments方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTagsForProperty
private IEnumerable<CompletionItem> GetTagsForProperty(IPropertySymbol symbol, TextSpan itemSpan, DocumentationCommentTriviaSyntax trivia, SyntaxToken token)
{
var items = new List<CompletionItem>();
if (symbol.IsIndexer)
{
var parameters = symbol.GetParameters().Select(p => p.Name).ToSet();
// User is trying to write a name, try to suggest only names.
if (token.Parent.IsKind(SyntaxKind.XmlNameAttribute) ||
(token.Parent.IsKind(SyntaxKind.IdentifierName) && token.Parent.IsParentKind(SyntaxKind.XmlNameAttribute)))
{
string parentElementName = null;
var emptyElement = token.GetAncestor<XmlEmptyElementSyntax>();
if (emptyElement != null)
{
parentElementName = emptyElement.Name.LocalName.Text;
}
// We're writing the name of a paramref
if (parentElementName == ParamRefTagName)
{
items.AddRange(parameters.Select(p => CreateCompletionItem(itemSpan, p)));
}
return items;
}
RemoveExistingTags(trivia, parameters, x => AttributeSelector(x, ParamTagName));
items.AddRange(parameters.Select(p => CreateCompletionItem(itemSpan, FormatParameter(ParamTagName, p))));
}
var typeParameters = symbol.GetTypeArguments().Select(p => p.Name).ToSet();
items.AddRange(typeParameters.Select(t => CreateCompletionItem(itemSpan, TypeParamTagName, NameAttributeName, t)));
items.Add(CreateCompletionItem(itemSpan, "value"));
return items;
}
示例2: GetTagsForProperty
private IEnumerable<CompletionItem> GetTagsForProperty(IPropertySymbol symbol, TextSpan filterSpan, DocumentationCommentTriviaSyntax trivia)
{
var items = new List<CompletionItem>();
var typeParameters = symbol.GetTypeArguments().Select(p => p.Name).ToSet();
RemoveExistingTags(trivia, typeParameters, x => AttributeSelector(x, "typeparam"));
items.AddRange(typeParameters.Select(t => new XmlItem(this, filterSpan, "typeparam", "name", t)));
items.Add(new XmlItem(this, filterSpan, "value"));
return items;
}
示例3: GetTagsForProperty
private IEnumerable<CompletionData> GetTagsForProperty(CompletionEngine engine, IPropertySymbol symbol, TextSpan filterSpan, DocumentationCommentTriviaSyntax trivia)
{
var items = new List<CompletionData>();
var typeParameters = symbol.GetTypeArguments().Select(p => p.Name).ToSet();
RemoveExistingTags(trivia, typeParameters, x => AttributeSelector(x, "typeparam"));
items.AddRange(typeParameters.Select(t => engine.Factory.CreateXmlDocCompletionData(this, "typeparam", null, "name$" + t)));
items.Add(engine.Factory.CreateXmlDocCompletionData(this, "value"));
return items;
}
示例4: GetTagsForProperty
private IEnumerable<CompletionItem> GetTagsForProperty(IPropertySymbol symbol, DocumentationCommentTriviaSyntax trivia)
{
var items = new List<CompletionItem>();
if (symbol.IsIndexer)
{
var parameters = symbol.GetParameters().Select(p => p.Name).ToSet();
RemoveExistingTags(trivia, parameters, x => AttributeSelector(x, ParamTagName));
items.AddRange(parameters.Select(p => CreateCompletionItem(FormatParameter(ParamTagName, p))));
}
var typeParameters = symbol.GetTypeArguments().Select(p => p.Name).ToSet();
items.AddRange(typeParameters.Select(t => CreateCompletionItem(TypeParamTagName, NameAttributeName, t)));
items.Add(CreateCompletionItem("value"));
return items;
}