[英]In Roslyn (Microsoft CodeAnalysis) how do I create a boolean literal?
通常我会使用SyntaxFactory但我无法弄清楚如何用它创建一个真或假节点。
I just figured it out. 我刚想通了。 true and false are keywords and I haven't had to deal with keywords much so I was looking in the wrong spot.
true和false是关键字,我没有必要处理关键字,所以我在寻找错误的位置。 Keywords apparently tend to rely on having their own SyntaxKind.
关键词显然倾向于拥有自己的SyntaxKind。
SyntaxFactory.LiteralExpression( SyntaxKind.TrueLiteralExpression );
After searching for the last hour I finally remembered this tool. 搜索完最后一小时后,我终于想起了这个工具。 If anyone has a similar problem that tool might be able to help.
如果有人有类似的问题,工具可能会有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.