SemanticModel.GetConstantValueCore(SyntaxNode, CancellationToken) 方法

定义

如果提供的节点具有常量值,则 HasValue 设置为 true 且值设置为常量时,将返回 Optional 值。 如果节点没有常量值,则使用 HasValue 设置为 false 返回可选值。

protected abstract Microsoft.CodeAnalysis.Optional<object> GetConstantValueCore (Microsoft.CodeAnalysis.SyntaxNode node, System.Threading.CancellationToken cancellationToken = default);
protected abstract Microsoft.CodeAnalysis.Optional<object?> GetConstantValueCore (Microsoft.CodeAnalysis.SyntaxNode node, System.Threading.CancellationToken cancellationToken = default);
abstract member GetConstantValueCore : Microsoft.CodeAnalysis.SyntaxNode * System.Threading.CancellationToken -> Microsoft.CodeAnalysis.Optional<obj>
Protected MustOverride Function GetConstantValueCore (node As SyntaxNode, Optional cancellationToken As CancellationToken = Nothing) As Optional(Of Object)

参数

node
SyntaxNode
cancellationToken
CancellationToken

返回

适用于