Udostępnij za pośrednictwem


ModelExtensions.GetSpeculativeAliasInfo Method

Definition

Binds the name in the context of the specified location and sees if it resolves to an alias name. If it does, return the AliasSymbol corresponding to it. Otherwise, return null.

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

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.

nameSyntax
SyntaxNode

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

bindingOption
SpeculativeBindingOption

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

Returns

Remarks

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

Applies to