本文整理汇总了C#中SyntaxNode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxNode.ToString方法的具体用法?C# SyntaxNode.ToString怎么用?C# SyntaxNode.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyntaxNode
的用法示例。
在下文中一共展示了SyntaxNode.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
public override void Visit(SyntaxNode node)
{
if (node is ExpressionSyntax)
{
TypeSymbol type = SemanticModel.GetTypeInfo((ExpressionSyntax)node).Type;
if (type != null)
{
Results.AppendLine();
Results.Append(node.GetType().Name);
Results.Append(" ");
Results.Append(node.ToString());
Results.Append(" has type ");
Results.Append(type.ToDisplayString());
}
}
base.Visit(node);
}
示例2: GetLogExpression
private ExpressionSyntax GetLogExpression(string name, SyntaxNode value)
{
return GetLogExpression (name, value.ToString());
}
示例3: Visit
public override void Visit(SyntaxNode node)
{
base.Visit(node);
logger.Info(node.ToString());
}
示例4: renderPropertyDeclaration
PropertyRenderInformation renderPropertyDeclaration(SyntaxNode node)
{
var propDecl = node as PropertyDeclarationSyntax;
if (propDecl == null) {
return new PropertyRenderInformation() {
anythingElse = new NameAndTypeRenderInformation() { name = chompedString(node.ToString()) },
};
}
var nameAndType = new NameAndTypeRenderInformation() {
name = chompedString(propDecl.Identifier.ValueText),
type = chompedString(propDecl.Type.PlainName),
};
var commands = new[] {
"ReactiveCommand",
"ReactiveAsyncCommand",
};
if (propDecl.Attributes.SelectMany(x => x.Attributes).Any(x => x.Name.PlainName == "Once") ||
commands.Contains(propDecl.Type.PlainName)) {
return new PropertyRenderInformation() { onceProp = nameAndType, };
}
if (propDecl.AccessorList.Accessors.Any(x => x.Keyword.Kind == SyntaxKind.SetKeyword)) {
return new PropertyRenderInformation() { readWriteProp = nameAndType, };
} else {
return new PropertyRenderInformation() { outputProp = nameAndType, };
}
}
示例5: AppendOperationTree
private static void AppendOperationTree(SemanticModel model, SyntaxNode node, StringBuilder actualTextBuilder, int initialIndent = 0)
{
IOperation operation = model.GetOperationInternal(node);
if (operation != null)
{
string operationTree = OperationTreeVerifier.GetOperationTree(operation, initialIndent);
actualTextBuilder.Append(operationTree);
}
else
{
actualTextBuilder.Append($" SemanticModel.GetOperation() returned NULL for node with text: '{node.ToString()}'");
}
}