CSharpExtensions.GetConstantValue 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
public static Microsoft.CodeAnalysis.Optional<object> GetConstantValue (this Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, System.Threading.CancellationToken cancellationToken = default);
public static Microsoft.CodeAnalysis.Optional<object> GetConstantValue (this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expression, System.Threading.CancellationToken cancellationToken = default);
static member GetConstantValue : Microsoft.CodeAnalysis.SemanticModel * Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax * System.Threading.CancellationToken -> Microsoft.CodeAnalysis.Optional<obj>
<Extension()>
Public Function GetConstantValue (semanticModel As SemanticModel, expression As ExpressionSyntax, Optional cancellationToken As CancellationToken = Nothing) As Optional(Of Object)
參數
- semanticModel
- SemanticModel
- expression
- ExpressionSyntax
- cancellationToken
- CancellationToken