Читати англійською

Поділитися через


ModelExtensions.GetSpeculativeSymbolInfo Method

Definition

Binds the node in the context of the specified location and get semantic information such as type, symbols and diagnostics. This method is used to get semantic information about an expression that did not actually appear in the source code.

C#
public static Microsoft.CodeAnalysis.SymbolInfo GetSpeculativeSymbolInfo(this Microsoft.CodeAnalysis.SemanticModel semanticModel, int position, Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SpeculativeBindingOption bindingOption);

Parameters

semanticModel
SemanticModel
position
Int32

A character position used to identify a declaration scope and accessibility. This character position must be within the FullSpan of the Root syntax node in this SemanticModel.

expression
SyntaxNode

A syntax node that represents a parsed expression. This syntax node need not and typically does not appear in the source code referred to SemanticModel instance.

bindingOption
SpeculativeBindingOption

Indicates whether to binding the expression as a full expressions, or as a type or namespace. If SpeculativeBindingOption.BindAsTypeOrNamespace is supplied, then expression should derive from TypeSyntax.

Returns

The semantic information for the topmost node of the expression.

Remarks

The passed in expression is interpreted as a stand-alone expression, as if it appeared by itself somewhere within the scope that encloses "position".

Applies to

Продукт Версії
Roslyn 4.2.0, 4.3.0, 4.4.0, 4.5.0, 4.6.0, 4.7.0, 4.8.0, 4.9.2, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.3.1, 3.4.0, 3.5.0, 3.6.0, 3.7.0, 3.8.0, 3.9.0, 3.10.0, 3.11.0, 4.0.1, 4.1.0, 4.12.2, 4.13.0