CSharpExtensions.GetConstantValue Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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)
Parameters
- semanticModel
- SemanticModel
- expression
- ExpressionSyntax
- cancellationToken
- CancellationToken