本文整理汇总了C#中UsingDirectiveSyntax类的典型用法代码示例。如果您正苦于以下问题:C# UsingDirectiveSyntax类的具体用法?C# UsingDirectiveSyntax怎么用?C# UsingDirectiveSyntax使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UsingDirectiveSyntax类属于命名空间,在下文中一共展示了UsingDirectiveSyntax类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: VisitUsingDirective
public override void VisitUsingDirective(UsingDirectiveSyntax node)
{
//if (node.Name.ToString() != "System" && !node.Name.ToString().StartsWith("System."))
//{
this.Usings.Add(node);
//}
}
开发者ID:piotrosz,项目名称:RoslynChart,代码行数:7,代码来源:UsingCollector.cs
示例2: VisitUsingDirective
protected override void VisitUsingDirective(UsingDirectiveSyntax node)
{
if (node.Name.GetText() != "System" &&
!node.Name.GetText().StartsWith("System."))
{
Usings.Add(node);
}
}
开发者ID:shayfriedman,项目名称:WhatCSharpCouldDoThat-Sample,代码行数:8,代码来源:Demo2.cs
示例3: AddUsingDirective
public static CompilationUnitSyntax AddUsingDirective(
this CompilationUnitSyntax root,
UsingDirectiveSyntax usingDirective,
SyntaxNode contextNode,
bool placeSystemNamespaceFirst,
params SyntaxAnnotation[] annotations)
{
return root.AddUsingDirectives(new[] { usingDirective }, contextNode, placeSystemNamespaceFirst, annotations);
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:9,代码来源:CompilationUnitSyntaxExtensions.cs
示例4: VisitUsingDirective
public override void VisitUsingDirective(UsingDirectiveSyntax node)
{
if (node.IsInSystemWindows() && !uiClass)
{
uiClass = true;
Result.generalAsyncResults.NumUIClasses++;
}
base.VisitUsingDirective(node);
}
开发者ID:modulexcite,项目名称:CSharpAnalyzer,代码行数:9,代码来源:GeneralAsyncDetectionWalker.cs
示例5: VisitUsingDirective
// Hay un visit por cada tipo de nodo. Es bastante útil.
public override void VisitUsingDirective(UsingDirectiveSyntax node)
{
// Propiedad últil de los nodos: CSharpKind (en este caso sería siempre UsingDirective)
/*Note the Name property of type NameSyntax; this stores the name of the namespace being imported.*/
if (node.Name.ToString() != "System" &&
!node.Name.ToString().StartsWith("System."))
{
this.Usings.Add(node);
}
}
开发者ID:asoifer,项目名称:Pruebas,代码行数:12,代码来源:UsingCollector.cs
示例6: GetFirstIdentifierInUsingDirective
private static SyntaxToken? GetFirstIdentifierInUsingDirective(UsingDirectiveSyntax usingDirective)
{
foreach (var identifier in usingDirective.DescendantNodes())
{
IdentifierNameSyntax identifierName = identifier as IdentifierNameSyntax;
if (identifierName != null && ExcludeGlobalKeyword(identifierName))
{
return identifierName.Identifier;
}
}
return null;
}
开发者ID:modulexcite,项目名称:PublicApiAnalyzer,代码行数:14,代码来源:UsingDirectiveSyntaxHelpers.cs
示例7: VisitUsingDirective
public override SyntaxNode VisitUsingDirective(UsingDirectiveSyntax node)
{
if (node == null) { throw new ArgumentNullException(nameof(node)); }
if (node.UsingKeyword.TrailingTrivia.FullSpan.IsEmpty)
{
node = node.WithUsingKeyword(node.UsingKeyword.WithTrailingTrivia(SyntaxFactory.Space));
}
if (node.SemicolonToken.TrailingTrivia.FullSpan.IsEmpty)
{
node = node.WithSemicolonToken(node.SemicolonToken.WithTrailingTrivia(this.newLineTrivia));
}
return node;
}
开发者ID:nicholjy,项目名称:stylize,代码行数:16,代码来源:OverQualifiedNameStyleRule.cs
示例8: VisitUsingDirective
//Note:It must exist, to shortcut visit the using [XXX], otherwise it will visit XXX
public override SyntaxNode VisitUsingDirective(UsingDirectiveSyntax node)
{
if (node.Alias != null)
{
this.AppendCompileIssue(node, IssueType.Error, IssueId.UsingAliasNotSupport);
}
else
{
if (_template.SupportUsing)
{
var template = _template.CreateUsingTemplate();
_output.Write(node, template.GetBeginString());
this.Visit(node.Name);
_output.TrivialWriteLine(template.GetEndString());
}
}
return node;
}
开发者ID:rexzh,项目名称:SharpJs,代码行数:19,代码来源:Rewriter_BasicStructure.cs
示例9: VisitUsingDirective
public override void VisitUsingDirective(UsingDirectiveSyntax node)
{
// these could theoretically be acquired by indexing the GAC or something
var namespaces = new List<String>
{
"System",
"System.Collections",
"System.Collections.Generic",
"System.Text",
"System.Linq"
};
string whatAreWeUsing = node.Name.ToString();
if (!namespaces.Contains(whatAreWeUsing))
{
var parts = whatAreWeUsing.Split('.');
cb.AppendIndent().Append("using namespace ").Append(string.Join("::", parts)).AppendLine(";");
}
}
开发者ID:codedecay,项目名称:Blackmire,代码行数:19,代码来源:CppHeaderWalker.cs
示例10: RemoveLeadingAndTrailingCompilerDirectives
private static UsingDirectiveSyntax RemoveLeadingAndTrailingCompilerDirectives(UsingDirectiveSyntax usingSyntax)
{
UsingDirectiveSyntax usingDirectiveToUse = usingSyntax;
if (usingDirectiveToUse.HasLeadingTrivia)
{
if (usingDirectiveToUse.HasLeadingTrivia)
{
var newLeadingTrivia = RemoveCompilerDirectives(usingDirectiveToUse.GetLeadingTrivia());
usingDirectiveToUse = usingDirectiveToUse.WithLeadingTrivia(newLeadingTrivia);
}
if (usingDirectiveToUse.HasTrailingTrivia)
{
var newTrailingTrivia = RemoveCompilerDirectives(usingDirectiveToUse.GetTrailingTrivia());
usingDirectiveToUse = usingDirectiveToUse.WithTrailingTrivia(newTrailingTrivia);
}
}
return usingDirectiveToUse;
}
开发者ID:chuck-mitchell,项目名称:codeformatter,代码行数:19,代码来源:MSTestToXUnitConverter.cs
示例11: ClassifyUsingDirectiveSyntax
private IEnumerable<ClassifiedSpan> ClassifyUsingDirectiveSyntax(
UsingDirectiveSyntax usingDirective,
SemanticModel semanticModel,
CancellationToken cancellationToken)
{
// For using aliases, we bind the target on the right of the equals and use that
// binding to classify the alias.
if (usingDirective.Alias != null)
{
var info = semanticModel.GetTypeInfo(usingDirective.Name, cancellationToken);
if (info.Type != null)
{
var classification = GetClassificationForType(info.Type);
if (classification != null)
{
var token = usingDirective.Alias.Name;
return SpecializedCollections.SingletonEnumerable(new ClassifiedSpan(token.Span, classification));
}
}
}
return null;
}
开发者ID:EkardNT,项目名称:Roslyn,代码行数:23,代码来源:UsingDirectiveSyntaxClassifier.cs
示例12: VisitUsingDirective
public override SyntaxNode VisitUsingDirective(UsingDirectiveSyntax node)
{
return null;
}
开发者ID:kontur-edu,项目名称:uLearn,代码行数:4,代码来源:ExerciseBuilder.cs
示例13: UsingsMatch
private static bool UsingsMatch(UsingDirectiveSyntax usingDirective1, UsingDirectiveSyntax usingDirective2)
{
return usingDirective1.Name.ToString() == usingDirective2.Name.ToString() && GetAliasName(usingDirective1) == GetAliasName(usingDirective2);
}
开发者ID:Rickinio,项目名称:roslyn,代码行数:4,代码来源:SnippetExpansionClient.cs
示例14: VisitUsingDirective
public override SyntaxNode VisitUsingDirective(UsingDirectiveSyntax node)
{
// The strip list is used to remove using directives that will be moved.
if (this.stripList.Contains(node))
{
var nextToken = node.SemicolonToken.GetNextToken();
if (!nextToken.IsKind(SyntaxKind.None))
{
var index = TriviaHelper.IndexOfFirstNonBlankLineTrivia(nextToken.LeadingTrivia);
if (index != 0)
{
this.tokensToStrip.AddLast(nextToken);
}
}
return null;
}
// The replacement map is used to replace using declarations in place in sorted order (inside directive trivia)
UsingDirectiveSyntax replacementNode;
if (this.replaceMap.TryGetValue(node, out replacementNode))
{
return replacementNode;
}
return base.VisitUsingDirective(node);
}
开发者ID:Romanx,项目名称:StyleCopAnalyzers,代码行数:28,代码来源:UsingCodeFixProvider.cs
示例15: AddUsingDirective
private void AddUsingDirective(Dictionary<DirectiveSpan, List<UsingDirectiveSyntax>> container, UsingDirectiveSyntax usingDirective, DirectiveSpan owningSpan)
{
List<UsingDirectiveSyntax> usingList;
if (!container.TryGetValue(owningSpan, out usingList))
{
usingList = new List<UsingDirectiveSyntax>();
container.Add(owningSpan, usingList);
}
usingList.Add(usingDirective);
}
开发者ID:Romanx,项目名称:StyleCopAnalyzers,代码行数:12,代码来源:UsingCodeFixProvider.cs
示例16: IsSeparatedSystemUsing
private bool IsSeparatedSystemUsing(UsingDirectiveSyntax syntax)
{
if (!this.separateSystemDirectives)
{
return false;
}
return syntax.Alias == null
&& syntax.IsSystemUsingDirective()
&& !syntax.HasNamespaceAliasQualifier()
&& syntax.StaticKeyword.IsKind(SyntaxKind.None);
}
开发者ID:Romanx,项目名称:StyleCopAnalyzers,代码行数:12,代码来源:UsingCodeFixProvider.cs
示例17: GetAliasName
private static string GetAliasName(UsingDirectiveSyntax usingDirective)
{
return (usingDirective.Alias == null || usingDirective.Alias.Name == null) ? null : usingDirective.Alias.Name.ToString();
}
开发者ID:GuilhermeSa,项目名称:roslyn,代码行数:4,代码来源:SnippetExpansionClient.cs
示例18: CompareSpanStart
private static int CompareSpanStart(UsingDirectiveSyntax left, UsingDirectiveSyntax right)
{
return left.SpanStart - right.SpanStart;
}
开发者ID:Romanx,项目名称:StyleCopAnalyzers,代码行数:4,代码来源:UsingCodeFixProvider.cs
示例19: VisitUsingDirective
public override void VisitUsingDirective(UsingDirectiveSyntax node)
{
CheckForInvalid(node);
base.VisitUsingDirective(node);
}
开发者ID:alecor191,项目名称:RefactoringEssentials,代码行数:5,代码来源:XmlDocAnalyzer.cs
示例20: NamespaceOrTypeAndUsingDirective
public NamespaceOrTypeAndUsingDirective(NamespaceOrTypeSymbol namespaceOrType, UsingDirectiveSyntax usingDirective)
{
this.NamespaceOrType = namespaceOrType;
this.UsingDirective = usingDirective;
}
开发者ID:EkardNT,项目名称:Roslyn,代码行数:5,代码来源:NamespaceOrTypeAndUsingDirective.cs
注:本文中的UsingDirectiveSyntax类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论