Condividi tramite


ModelExtensions.GetSpeculativeTypeInfo 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.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::CodeAnalysis::TypeInfo GetSpeculativeTypeInfo(Microsoft::CodeAnalysis::SemanticModel ^ semanticModel, int position, Microsoft::CodeAnalysis::SyntaxNode ^ expression, Microsoft::CodeAnalysis::SpeculativeBindingOption bindingOption);
public static Microsoft.CodeAnalysis.TypeInfo GetSpeculativeTypeInfo (this Microsoft.CodeAnalysis.SemanticModel semanticModel, int position, Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SpeculativeBindingOption bindingOption);
static member GetSpeculativeTypeInfo : Microsoft.CodeAnalysis.SemanticModel * int * Microsoft.CodeAnalysis.SyntaxNode * Microsoft.CodeAnalysis.SpeculativeBindingOption -> Microsoft.CodeAnalysis.TypeInfo
<Extension()>
Public Function GetSpeculativeTypeInfo (semanticModel As SemanticModel, position As Integer, expression As SyntaxNode, bindingOption As SpeculativeBindingOption) As TypeInfo

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