Megosztás a következőn keresztül:


SemanticModel Class

Definition

Allows asking semantic questions about a tree of syntax nodes in a Compilation. Typically, an instance is obtained by a call to GetBinding on a Compilation or Compilation.

public ref class SemanticModel abstract
public abstract class SemanticModel
type SemanticModel = class
Public MustInherit Class SemanticModel
Inheritance
SemanticModel

Remarks

An instance of SemanticModel caches local symbols and semantic information. Thus, it is much more efficient to use a single instance of SemanticModel when asking multiple questions about a syntax tree, because information from the first question may be reused. This also means that holding onto an instance of SemanticModel for a long time may keep a significant amount of memory from being garbage collected.

When an answer is a named symbol that is reachable by traversing from the root of the symbol table, (that is, from an AssemblySymbol of the Compilation), that symbol will be returned (i.e. the returned value will be reference-equal to one reachable from the root of the symbol table). Symbols representing entities without names (e.g. array-of-int) may or may not exhibit reference equality. However, some named symbols (such as local variables) are not reachable from the root. These symbols are visible as answers to semantic questions. When the same SemanticModel object is used, the answers exhibit reference-equality.

Constructors

SemanticModel()

Properties

Compilation

The compilation this model was obtained from.

CompilationCore

The compilation this model was obtained from.

IgnoresAccessibility

Returns true if this is a SemanticModel that ignores accessibility rules when answering semantic questions.

IsSpeculativeSemanticModel

Returns true if this is a speculative semantic model created with any of the TryGetSpeculativeSemanticModel methods.

Language

Gets the source language ("C#" or "Visual Basic").

OriginalPositionForSpeculation

If this is a speculative semantic model, returns the original position at which the speculative model was created. Otherwise, returns 0.

ParentModel

If this is a speculative semantic model, then returns its parent semantic model. Otherwise, returns null.

ParentModelCore

If this is a speculative semantic model, then returns its parent semantic model. Otherwise, returns null.

RootCore

Root of this semantic model

SyntaxTree

The syntax tree this model was obtained from.

SyntaxTreeCore

The syntax tree this model was obtained from.

Methods

AnalyzeControlFlowCore(SyntaxNode, SyntaxNode)

Analyze control-flow within a part of a method body.

AnalyzeControlFlowCore(SyntaxNode)

Analyze control-flow within a part of a method body.

AnalyzeDataFlowCore(SyntaxNode, SyntaxNode)

Analyze data-flow within a part of a method body.

AnalyzeDataFlowCore(SyntaxNode)

Analyze data-flow within a part of a method body.

GetAliasInfoCore(SyntaxNode, CancellationToken)

If "nameSyntax" resolves to an alias name, return the IAliasSymbol corresponding to A. Otherwise return null.

GetConstantValue(SyntaxNode, CancellationToken)

If the node provided has a constant value an Optional value will be returned with HasValue set to true and with Value set to the constant. If the node does not have an constant value, an Optional will be returned with HasValue set to false.

GetConstantValueCore(SyntaxNode, CancellationToken)

If the node provided has a constant value an Optional value will be returned with HasValue set to true and with Value set to the constant. If the node does not have an constant value, an Optional will be returned with HasValue set to false.

GetDeclarationDiagnostics(Nullable<TextSpan>, CancellationToken)

Get all of the declaration errors within the syntax tree associated with this object. Does not get errors involving incorrect syntax, compiling method bodies or initializers.

GetDeclaredSymbolCore(SyntaxNode, CancellationToken)

Gets the symbol associated with a declaration syntax node.

GetDeclaredSymbolsCore(SyntaxNode, CancellationToken)

Gets the symbols associated with a declaration syntax node. Unlike Microsoft.CodeAnalysis.SemanticModel.GetDeclaredSymbolForNode(Microsoft.CodeAnalysis.SyntaxNode,System.Threading.CancellationToken), this method returns all symbols declared by a given declaration syntax node. Specifically:

GetDiagnostics(Nullable<TextSpan>, CancellationToken)

Get all the errors within the syntax tree associated with this object. Includes errors involving compiling method bodies or initializers, in addition to the errors returned by GetDeclarationDiagnostics.

GetEnclosingSymbol(Int32, CancellationToken)

Given a position in the SyntaxTree for this SemanticModel returns the innermost Symbol that the position is considered inside of.

GetEnclosingSymbolCore(Int32, CancellationToken)

Given a position in the SyntaxTree for this SemanticModel returns the innermost Symbol that the position is considered inside of.

GetImportScopes(Int32, CancellationToken)

Given a position in the SyntaxTree for this SemanticModel returns the IImportScopes at that point. Scopes are ordered from closest to the passed in position to the furthest. See IImportScope for a deeper description of what information is available for each scope.

GetMemberGroupCore(SyntaxNode, CancellationToken)

When getting information for a symbol that resolves to a method group or property group, from which a method is then chosen; the chosen method or property is present in Symbol; all methods in the group that was consulted are placed in this property.

GetMethodBodyDiagnostics(Nullable<TextSpan>, CancellationToken)

Get all of the method body and initializer errors within the syntax tree associated with this object. Does not get errors involving incorrect syntax or declarations.

GetNullableContext(Int32)

Gets the NullableContext at a position in the file.

GetOperation(SyntaxNode, CancellationToken)

Gets the operation corresponding to the expression or statement syntax node.

GetOperationCore(SyntaxNode, CancellationToken)
GetPreprocessingSymbolInfo(SyntaxNode)

If nameSyntax is an identifier name syntax node, return the PreprocessingSymbolInfo corresponding to it.

GetPreprocessingSymbolInfoCore(SyntaxNode)

If nameSyntax is an identifier name syntax node, return the PreprocessingSymbolInfo corresponding to it.

GetSpeculativeAliasInfoCore(Int32, SyntaxNode, SpeculativeBindingOption)

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.

GetSpeculativeSymbolInfoCore(Int32, SyntaxNode, SpeculativeBindingOption)

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.

GetSpeculativeTypeInfoCore(Int32, SyntaxNode, SpeculativeBindingOption)

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.

GetSymbolInfoCore(SyntaxNode, CancellationToken)

Gets symbol information about a syntax node.

GetSyntaxDiagnostics(Nullable<TextSpan>, CancellationToken)

Get all of the syntax errors within the syntax tree associated with this object. Does not get errors involving declarations or compiling method bodies or initializers.

GetTopmostNodeForDiagnosticAnalysis(ISymbol, SyntaxNode)

Takes a Symbol and syntax for one of its declaring syntax reference and returns the topmost syntax node to be used by syntax analyzer.

GetTypeInfoCore(SyntaxNode, CancellationToken)

Gets type information about a syntax node.

IsAccessible(Int32, ISymbol)

Determines if the symbol is accessible from the specified location.

IsAccessibleCore(Int32, ISymbol)

Determines if the symbol is accessible from the specified location.

IsEventUsableAsField(Int32, IEventSymbol)

Field-like events can be used as fields in types that can access private members of the declaring type of the event.

IsEventUsableAsFieldCore(Int32, IEventSymbol)

Field-like events can be used as fields in types that can access private members of the declaring type of the event.

LookupBaseMembers(Int32, String)

Gets the available base type members in the context of the specified location. Akin to calling LookupSymbols(Int32, INamespaceOrTypeSymbol, String, Boolean) with the container set to the immediate base type of the type in which position occurs. However, the accessibility rules are different: protected members of the base type will be visible.

Consider the following example:

public class Base { protected void M() { } }

public class Derived : Base { void Test(Base b) { b.M(); // Error - cannot access protected member. base.M(); } }

Protected members of an instance of another type are only accessible if the instance is known to be "this" instance (as indicated by the "base" keyword).

LookupBaseMembersCore(Int32, String)

Backing implementation of LookupBaseMembers(Int32, String).

LookupLabels(Int32, String)

Gets the available named label symbols in the context of the specified location and optional container. Only members that are accessible and visible from the given location are returned.

LookupLabelsCore(Int32, String)

Backing implementation of LookupLabels(Int32, String).

LookupNamespacesAndTypes(Int32, INamespaceOrTypeSymbol, String)

Gets the available named namespace and type symbols in the context of the specified location and optional container. Only members that are accessible and visible from the given location are returned.

LookupNamespacesAndTypesCore(Int32, INamespaceOrTypeSymbol, String)

Backing implementation of LookupNamespacesAndTypes(Int32, INamespaceOrTypeSymbol, String).

LookupStaticMembers(Int32, INamespaceOrTypeSymbol, String)

Gets the available named static member symbols in the context of the specified location and optional container. Only members that are accessible and visible from the given location are returned.

Non-reduced extension methods are considered, since they are static methods.

LookupStaticMembersCore(Int32, INamespaceOrTypeSymbol, String)

Backing implementation of LookupStaticMembers(Int32, INamespaceOrTypeSymbol, String).

LookupSymbols(Int32, INamespaceOrTypeSymbol, String, Boolean)

Gets the available named symbols in the context of the specified location and optional container. Only symbols that are accessible and visible from the given location are returned.

LookupSymbolsCore(Int32, INamespaceOrTypeSymbol, String, Boolean)

Backing implementation of LookupSymbols(Int32, INamespaceOrTypeSymbol, String, Boolean).

Extension Methods

AnalyzeControlFlow(SemanticModel, StatementSyntax, StatementSyntax)

Analyze control-flow within a part of a method body.

AnalyzeControlFlow(SemanticModel, StatementSyntax)

Analyze control-flow within a part of a method body.

AnalyzeDataFlow(SemanticModel, ConstructorInitializerSyntax)

Analyze data-flow within a ConstructorInitializerSyntax.

AnalyzeDataFlow(SemanticModel, ExpressionSyntax)

Analyze data-flow within an ExpressionSyntax.

AnalyzeDataFlow(SemanticModel, PrimaryConstructorBaseTypeSyntax)

Analyze data-flow within a ArgumentList initializer.

AnalyzeDataFlow(SemanticModel, StatementSyntax, StatementSyntax)

Analyze data-flow within a part of a method body.

AnalyzeDataFlow(SemanticModel, StatementSyntax)

Analyze data-flow within a part of a method body.

ClassifyConversion(SemanticModel, ExpressionSyntax, ITypeSymbol, Boolean)

Determines what type of conversion, if any, would be used if a given expression was converted to a given type. If isExplicitInSource is true, the conversion produced is that which would be used if the conversion were done for a cast expression.

ClassifyConversion(SemanticModel, Int32, ExpressionSyntax, ITypeSymbol, Boolean)

Determines what type of conversion, if any, would be used if a given expression was converted to a given type. If isExplicitInSource is true, the conversion produced is that which would be used if the conversion were done for a cast expression.

GetAliasInfo(SemanticModel, IdentifierNameSyntax, CancellationToken)

If nameSyntax resolves to an alias name, return the AliasSymbol corresponding to A. Otherwise return null.

GetAwaitExpressionInfo(SemanticModel, AwaitExpressionSyntax)
GetCollectionInitializerSymbolInfo(SemanticModel, ExpressionSyntax, CancellationToken)

Returns what 'Add' method symbol(s), if any, corresponds to the given expression syntax within Initializer.

GetConstantValue(SemanticModel, ExpressionSyntax, CancellationToken)
GetConversion(SemanticModel, SyntaxNode, CancellationToken)
GetDeclaredSymbol(SemanticModel, AccessorDeclarationSyntax, CancellationToken)

Given a syntax node that declares a property or member accessor, get the corresponding symbol.

GetDeclaredSymbol(SemanticModel, AnonymousObjectCreationExpressionSyntax, CancellationToken)

Given a syntax node of anonymous object creation expression, get the anonymous object type symbol.

GetDeclaredSymbol(SemanticModel, AnonymousObjectMemberDeclaratorSyntax, CancellationToken)

Given a syntax node of anonymous object creation initializer, get the anonymous object property symbol.

GetDeclaredSymbol(SemanticModel, ArgumentSyntax, CancellationToken)

Given a syntax node of a tuple argument, get the tuple element symbol.

GetDeclaredSymbol(SemanticModel, BaseMethodDeclarationSyntax, CancellationToken)

Given a base method declaration syntax, get the corresponding method symbol.

GetDeclaredSymbol(SemanticModel, BasePropertyDeclarationSyntax, CancellationToken)

Given a syntax node that declares a property, indexer or an event, get the corresponding declared symbol.

GetDeclaredSymbol(SemanticModel, BaseTypeDeclarationSyntax, CancellationToken)

Given a type declaration, get the corresponding type symbol.

GetDeclaredSymbol(SemanticModel, CatchDeclarationSyntax, CancellationToken)

Given a catch declaration, get the symbol for the exception variable

GetDeclaredSymbol(SemanticModel, CompilationUnitSyntax, CancellationToken)

Given a compilation unit syntax, get the corresponding Simple Program entry point symbol.

GetDeclaredSymbol(SemanticModel, DelegateDeclarationSyntax, CancellationToken)

Given a delegate declaration, get the corresponding type symbol.

GetDeclaredSymbol(SemanticModel, EnumMemberDeclarationSyntax, CancellationToken)

Given a enum member declaration, get the corresponding field symbol.

GetDeclaredSymbol(SemanticModel, EventDeclarationSyntax, CancellationToken)

Given a syntax node that declares a (custom) event, get the corresponding event symbol.

GetDeclaredSymbol(SemanticModel, ExternAliasDirectiveSyntax, CancellationToken)

Given an extern alias declaration get the corresponding symbol for the alias that was introduced.

GetDeclaredSymbol(SemanticModel, FileScopedNamespaceDeclarationSyntax, CancellationToken)

Given a namespace declaration syntax node, get the corresponding namespace symbol for the declaration assembly.

GetDeclaredSymbol(SemanticModel, ForEachStatementSyntax, CancellationToken)

Given a foreach statement, get the symbol for the iteration variable

GetDeclaredSymbol(SemanticModel, IndexerDeclarationSyntax, CancellationToken)

Given a syntax node that declares an indexer, get the corresponding declared symbol.

GetDeclaredSymbol(SemanticModel, JoinIntoClauseSyntax, CancellationToken)

Get the query range variable declared in a join into clause.

GetDeclaredSymbol(SemanticModel, LabeledStatementSyntax, CancellationToken)

Given a labeled statement syntax, get the corresponding label symbol.

GetDeclaredSymbol(SemanticModel, LocalFunctionStatementSyntax, CancellationToken)

Given a local function declaration syntax, get the corresponding symbol.

GetDeclaredSymbol(SemanticModel, MemberDeclarationSyntax, CancellationToken)

Given a member declaration syntax, get the corresponding symbol.

GetDeclaredSymbol(SemanticModel, NamespaceDeclarationSyntax, CancellationToken)

Given a namespace declaration syntax node, get the corresponding namespace symbol for the declaration assembly.

GetDeclaredSymbol(SemanticModel, ParameterSyntax, CancellationToken)

Given a parameter declaration syntax node, get the corresponding symbol.

GetDeclaredSymbol(SemanticModel, PropertyDeclarationSyntax, CancellationToken)

Given a syntax node that declares a property, get the corresponding declared symbol.

GetDeclaredSymbol(SemanticModel, QueryClauseSyntax, CancellationToken)
GetDeclaredSymbol(SemanticModel, QueryContinuationSyntax, CancellationToken)

Get the query range variable declared in a query continuation clause.

GetDeclaredSymbol(SemanticModel, SingleVariableDesignationSyntax, CancellationToken)

Given a variable declarator syntax, get the corresponding symbol.

GetDeclaredSymbol(SemanticModel, SwitchLabelSyntax, CancellationToken)

Given a switch label syntax, get the corresponding label symbol.

GetDeclaredSymbol(SemanticModel, TupleElementSyntax, CancellationToken)

Given a tuple element syntax, get the corresponding symbol.

GetDeclaredSymbol(SemanticModel, TupleExpressionSyntax, CancellationToken)

Given a syntax node of tuple expression, get the tuple type symbol.

GetDeclaredSymbol(SemanticModel, TypeParameterSyntax, CancellationToken)

Given a type parameter declaration (field or method), get the corresponding symbol

GetDeclaredSymbol(SemanticModel, UsingDirectiveSyntax, CancellationToken)

Given a using declaration get the corresponding symbol for the using alias that was introduced.

GetDeclaredSymbol(SemanticModel, VariableDeclaratorSyntax, CancellationToken)

Given a variable declarator syntax, get the corresponding symbol.

GetDeconstructionInfo(SemanticModel, AssignmentExpressionSyntax)
GetDeconstructionInfo(SemanticModel, ForEachVariableStatementSyntax)
GetForEachStatementInfo(SemanticModel, CommonForEachStatementSyntax)
GetForEachStatementInfo(SemanticModel, ForEachStatementSyntax)
GetIndexerGroup(SemanticModel, ExpressionSyntax, CancellationToken)

Returns the list of accessible, non-hidden indexers that could be invoked with the given expression as receiver.

GetMemberGroup(SemanticModel, AttributeSyntax, CancellationToken)
GetMemberGroup(SemanticModel, ConstructorInitializerSyntax, CancellationToken)
GetMemberGroup(SemanticModel, ExpressionSyntax, CancellationToken)
GetQueryClauseInfo(SemanticModel, QueryClauseSyntax, CancellationToken)

Gets the semantic information associated with a query clause.

GetSpeculativeAliasInfo(SemanticModel, Int32, IdentifierNameSyntax, SpeculativeBindingOption)

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.

GetSpeculativeConversion(SemanticModel, Int32, ExpressionSyntax, SpeculativeBindingOption)
GetSpeculativeSymbolInfo(SemanticModel, Int32, AttributeSyntax)

Bind the attribute 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 attribute that did not actually appear in the source code.

GetSpeculativeSymbolInfo(SemanticModel, Int32, ConstructorInitializerSyntax)

Bind the constructor initializer 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 a constructor initializer that did not actually appear in the source code.

NOTE: This will only work in locations where there is already a constructor initializer.

GetSpeculativeSymbolInfo(SemanticModel, Int32, CrefSyntax, SpeculativeBindingOption)

Binds the CrefSyntax expression in the context of the specified location and gets symbol information. This method is used to get symbol information about an expression that did not actually appear in the source code.

GetSpeculativeSymbolInfo(SemanticModel, Int32, ExpressionSyntax, SpeculativeBindingOption)

Binds the expression in the context of the specified location and gets symbol information. This method is used to get symbol information about an expression that did not actually appear in the source code.

GetSpeculativeSymbolInfo(SemanticModel, Int32, PrimaryConstructorBaseTypeSyntax)

Bind the constructor initializer in the context of the specified location and get semantic information about symbols. This method is used to get semantic information about a constructor initializer that did not actually appear in the source code.

NOTE: This will only work in locations where there is already a constructor initializer. PrimaryConstructorBaseTypeSyntax.

GetSpeculativeTypeInfo(SemanticModel, Int32, ExpressionSyntax, SpeculativeBindingOption)

Binds the expression in the context of the specified location and gets type information. This method is used to get type information about an expression that did not actually appear in the source code.

GetSymbolInfo(SemanticModel, AttributeSyntax, CancellationToken)

Returns what symbol(s), if any, the given attribute syntax bound to in the program.

GetSymbolInfo(SemanticModel, ConstructorInitializerSyntax, CancellationToken)

Returns what symbol(s), if any, the given constructor initializer syntax bound to in the program.

GetSymbolInfo(SemanticModel, CrefSyntax, CancellationToken)

Gets the semantic information associated with a documentation comment cref.

GetSymbolInfo(SemanticModel, ExpressionSyntax, CancellationToken)

Returns what symbol(s), if any, the given expression syntax bound to in the program.

An AliasSymbol will never be returned by this method. What the alias refers to will be returned instead. To get information about aliases, call GetAliasInfo.

If binding the type name C in the expression "new C(...)" the actual constructor bound to will be returned (or all constructor if overload resolution failed). This occurs as long as C unambiguously binds to a single type that has a constructor. If C ambiguously binds to multiple types, or C binds to a static class, then type(s) are returned.

GetSymbolInfo(SemanticModel, OrderingSyntax, CancellationToken)

Gets the semantic information for an ordering clause in an orderby query clause.

GetSymbolInfo(SemanticModel, PrimaryConstructorBaseTypeSyntax, CancellationToken)

Returns what symbol(s), if any, the given constructor initializer syntax bound to in the program.

GetSymbolInfo(SemanticModel, SelectOrGroupClauseSyntax, CancellationToken)

Gets the semantic information associated with a select or group clause.

GetTypeInfo(SemanticModel, AttributeSyntax, CancellationToken)

Gets type information about an attribute.

GetTypeInfo(SemanticModel, ConstructorInitializerSyntax, CancellationToken)

Gets type information about a constructor initializer.

GetTypeInfo(SemanticModel, ExpressionSyntax, CancellationToken)

Gets type information about an expression.

GetTypeInfo(SemanticModel, SelectOrGroupClauseSyntax, CancellationToken)
TryGetSpeculativeSemanticModel(SemanticModel, Int32, ArrowExpressionClauseSyntax, SemanticModel)

Get a SemanticModel object that is associated with an expression body that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of an expression body that did not appear in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, AttributeSyntax, SemanticModel)

Get a SemanticModel object that is associated with an attribute that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of an attribute that did not appear in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, ConstructorInitializerSyntax, SemanticModel)

Get a SemanticModel object that is associated with a constructor initializer that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a constructor initializer that did not appear in source code.

NOTE: This will only work in locations where there is already a constructor initializer.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, CrefSyntax, SemanticModel)

Get a SemanticModel object that is associated with a cref syntax node that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a cref syntax that did not appear in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, EqualsValueClauseSyntax, SemanticModel)

Get a SemanticModel object that is associated with an initializer that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a field initializer or default parameter value that did not appear in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, PrimaryConstructorBaseTypeSyntax, SemanticModel)

Get a SemanticModel object that is associated with a constructor initializer that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a constructor initializer that did not appear in source code.

NOTE: This will only work in locations where there is already a constructor initializer.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, StatementSyntax, SemanticModel)

Get a SemanticModel object that is associated with a statement that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a statement that did not appear in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, TypeSyntax, SemanticModel, SpeculativeBindingOption)

Get a SemanticModel object that is associated with a type syntax node that did not appear in this source code. This can be used to get detailed semantic information about sub-parts of a type syntax that did not appear in source code.

TryGetSpeculativeSemanticModelForMethodBody(SemanticModel, Int32, AccessorDeclarationSyntax, SemanticModel)

Get a SemanticModel object that is associated with a method body that did not appear in this source code. Given position must lie within an existing method body of the Root syntax node for this SemanticModel. Locals and labels declared within this existing method body are not considered to be in scope of the speculated method body.

TryGetSpeculativeSemanticModelForMethodBody(SemanticModel, Int32, BaseMethodDeclarationSyntax, SemanticModel)

Get a SemanticModel object that is associated with a method body that did not appear in this source code. Given position must lie within an existing method body of the Root syntax node for this SemanticModel. Locals and labels declared within this existing method body are not considered to be in scope of the speculated method body.

AnalyzeControlFlow(SemanticModel, SyntaxNode, SyntaxNode)

Analyze control-flow within a part of a method body.

AnalyzeControlFlow(SemanticModel, SyntaxNode)

Analyze control-flow within a part of a method body.

AnalyzeDataFlow(SemanticModel, SyntaxNode, SyntaxNode)

Analyze data-flow within a part of a method body.

AnalyzeDataFlow(SemanticModel, SyntaxNode)

Analyze data-flow within a part of a method body. note (for C#): ConstructorInitializerSyntax and PrimaryConstructorBaseTypeSyntax are treated by this API as regular statements

GetAliasInfo(SemanticModel, SyntaxNode, CancellationToken)

If "nameSyntax" resolves to an alias name, return the IAliasSymbol corresponding to A. Otherwise return null.

GetDeclaredSymbol(SemanticModel, SyntaxNode, CancellationToken)

Gets the symbol associated with a declaration syntax node.

GetMemberGroup(SemanticModel, SyntaxNode, CancellationToken)

Gets a list of method or indexed property symbols for a syntax node.

GetSpeculativeAliasInfo(SemanticModel, Int32, SyntaxNode, SpeculativeBindingOption)

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.

GetSpeculativeSymbolInfo(SemanticModel, Int32, SyntaxNode, SpeculativeBindingOption)

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.

GetSpeculativeTypeInfo(SemanticModel, Int32, SyntaxNode, SpeculativeBindingOption)

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.

GetSymbolInfo(SemanticModel, SyntaxNode, CancellationToken)

Gets symbol information about a syntax node.

GetTypeInfo(SemanticModel, SyntaxNode, CancellationToken)

Gets type information about a syntax node.

AnalyzeControlFlow(SemanticModel, StatementSyntax, StatementSyntax)

Analyze control-flow within a part of a method body.

AnalyzeControlFlow(SemanticModel, StatementSyntax)

Analyze control-flow within a part of a method body.

AnalyzeDataFlow(SemanticModel, ExpressionSyntax)

Analyze data-flow within an expression.

AnalyzeDataFlow(SemanticModel, StatementSyntax, StatementSyntax)

Analyze data-flow within a set of contiguous statements.

AnalyzeDataFlow(SemanticModel, StatementSyntax)

Analyze data-flow within a statement.

ClassifyConversion(SemanticModel, ExpressionSyntax, ITypeSymbol)

Determines what kind of conversion there is between the expression syntax and a specified type.

ClassifyConversion(SemanticModel, Int32, ExpressionSyntax, ITypeSymbol)

Determines what kind of conversion there is between the expression syntax and a specified type.

GetAggregateClauseSymbolInfo(SemanticModel, AggregateClauseSyntax, CancellationToken)

Returns information about methods associated with AggregateClauseSyntax.

GetAliasInfo(SemanticModel, IdentifierNameSyntax, CancellationToken)

If "nameSyntax" resolves to an alias name, return the AliasSymbol corresponding to A. Otherwise return null.

GetAwaitExpressionInfo(SemanticModel, AwaitExpressionSyntax, CancellationToken)

Gets the corresponding AwaitExpressionInfo containing semantic info for a specified AwaitExpressionSyntax.

GetCollectionInitializerSymbolInfo(SemanticModel, ExpressionSyntax, CancellationToken)

Returns what 'Add' method symbol(s), if any, corresponds to the given expression syntax within Initializer.

GetCollectionRangeVariableSymbolInfo(SemanticModel, CollectionRangeVariableSyntax, CancellationToken)

Returns information about methods associated with CollectionRangeVariableSyntax.

GetConversion(SemanticModel, SyntaxNode, CancellationToken)

Gets the corresponding TypeInfo containing semantic info for a specified ExpressionSyntax.

GetDeclaredSymbol(SemanticModel, AccessorStatementSyntax, CancellationToken)

Gets the corresponding MethodSymbol for a specified AccessorStatementSyntax.

GetDeclaredSymbol(SemanticModel, AggregationRangeVariableSyntax, CancellationToken)

Gets the corresponding RangeVariableSymbol for a specified AggregationRangeVariableSyntax.

GetDeclaredSymbol(SemanticModel, AnonymousObjectCreationExpressionSyntax, CancellationToken)

Gets the corresponding NamedTypeSymbol for a specified AnonymousObjectCreationExpressionSyntax.

GetDeclaredSymbol(SemanticModel, CatchStatementSyntax, CancellationToken)

Gets the corresponding LocalSymbol for a specified CatchStatementSyntax.

GetDeclaredSymbol(SemanticModel, CollectionRangeVariableSyntax, CancellationToken)

Gets the corresponding RangeVariableSymbol for a specified CollectionRangeVariableSyntax.

GetDeclaredSymbol(SemanticModel, DeclareStatementSyntax, CancellationToken)

Gets the corresponding symbol for a specified DeclareStatementSyntax.

GetDeclaredSymbol(SemanticModel, DelegateStatementSyntax, CancellationToken)

Gets the corresponding NamedTypeSymbol for a specified DelegateStatementSyntax.

GetDeclaredSymbol(SemanticModel, EnumBlockSyntax, CancellationToken)

Gets the corresponding NamedTypeSymbol for a specified EnumBlockSyntax.

GetDeclaredSymbol(SemanticModel, EnumMemberDeclarationSyntax, CancellationToken)

Gets the corresponding FieldSymbol for a specified EnumMemberDeclarationSyntax.

GetDeclaredSymbol(SemanticModel, EnumStatementSyntax, CancellationToken)

Gets the corresponding NamedTypeSymbol for a specified EnumStatementSyntax.

GetDeclaredSymbol(SemanticModel, EventBlockSyntax, CancellationToken)

Gets the corresponding EventSymbol for a specified EventBlockSyntax.

GetDeclaredSymbol(SemanticModel, EventStatementSyntax, CancellationToken)

Gets the corresponding EventSymbol for a specified EventStatementSyntax.

GetDeclaredSymbol(SemanticModel, ExpressionRangeVariableSyntax, CancellationToken)

Gets the corresponding RangeVariableSymbol for a specified ExpressionRangeVariableSyntax.

GetDeclaredSymbol(SemanticModel, FieldInitializerSyntax, CancellationToken)

Gets the corresponding PropertySymbol for a specified FieldInitializerSyntax.

GetDeclaredSymbol(SemanticModel, LabelStatementSyntax, CancellationToken)

Gets the corresponding LabelSymbol for a specified LabelStatementSyntax.

GetDeclaredSymbol(SemanticModel, MethodBlockBaseSyntax, CancellationToken)

Gets the corresponding MethodSymbol for a specified MethodBlockBaseSyntax.

GetDeclaredSymbol(SemanticModel, MethodStatementSyntax, CancellationToken)

Gets the corresponding MethodSymbol for a specified MethodStatementSyntax.

GetDeclaredSymbol(SemanticModel, ModifiedIdentifierSyntax, CancellationToken)

Gets the corresponding symbol for a specified identifier.

GetDeclaredSymbol(SemanticModel, NamespaceBlockSyntax, CancellationToken)

Gets the corresponding NamespaceSymbol for a specified NamespaceBlockSyntax.

GetDeclaredSymbol(SemanticModel, NamespaceStatementSyntax, CancellationToken)

Gets the corresponding NamespaceSymbol for a specified NamespaceStatementSyntax.

GetDeclaredSymbol(SemanticModel, OperatorStatementSyntax, CancellationToken)

Gets the corresponding MethodSymbol for a specified OperatorStatementSyntax.

GetDeclaredSymbol(SemanticModel, ParameterSyntax, CancellationToken)

Gets the corresponding ParameterSymbol for a specified ParameterSyntax.

GetDeclaredSymbol(SemanticModel, PropertyBlockSyntax, CancellationToken)

Gets the corresponding PropertySymbol for a specified PropertyBlockSyntax.

GetDeclaredSymbol(SemanticModel, PropertyStatementSyntax, CancellationToken)

Gets the corresponding PropertySymbol for a specified PropertyStatementSyntax.

GetDeclaredSymbol(SemanticModel, SimpleImportsClauseSyntax, CancellationToken)

Gets the corresponding AliasSymbol for a specified AliasImportsClauseSyntax.

GetDeclaredSymbol(SemanticModel, SubNewStatementSyntax, CancellationToken)

Gets the corresponding MethodSymbol for a specified SubNewStatementSyntax.

GetDeclaredSymbol(SemanticModel, TupleElementSyntax, CancellationToken)

Gets the corresponding symbol for a specified tuple element.

GetDeclaredSymbol(SemanticModel, TypeBlockSyntax, CancellationToken)

Gets the corresponding NamedTypeSymbol for a specified TypeBlockSyntax.

GetDeclaredSymbol(SemanticModel, TypeParameterSyntax, CancellationToken)

Gets the corresponding TypeParameterSymbol Symbol for a specified TypeParameterSyntax.

GetDeclaredSymbol(SemanticModel, TypeStatementSyntax, CancellationToken)

Gets the corresponding NamedTypeSymbol for a specified TypeStatementSyntax.

GetForEachStatementInfo(SemanticModel, ForEachBlockSyntax)

Gets the corresponding ForEachStatementInfo containing semantic info for a specified ForBlockSyntax.

GetForEachStatementInfo(SemanticModel, ForEachStatementSyntax)

Gets the corresponding ForEachStatementInfo containing semantic info for a specified ForEachStatementSyntax.

GetMemberGroup(SemanticModel, AttributeSyntax, CancellationToken)

Gets the corresponding ImmutableArray of Symbols for a specified AttributeSyntax.

GetMemberGroup(SemanticModel, ExpressionSyntax, CancellationToken)

Gets the corresponding ImmutableArray of Symbols for a specified ExpressionSyntax.

GetPreprocessingSymbolInfo(SemanticModel, IdentifierNameSyntax)

If the given node is within a preprocessing directive, gets the preprocessing symbol info for it.

GetSpeculativeAliasInfo(SemanticModel, Int32, IdentifierNameSyntax, SpeculativeBindingOption)

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.

GetSpeculativeConversion(SemanticModel, Int32, ExpressionSyntax, SpeculativeBindingOption)
GetSpeculativeMemberGroup(SemanticModel, Int32, ExpressionSyntax)

Gets the corresponding ImmutableArray of Symbols for a speculating an ExpressionSyntax at a given position, used in Semantic Info for items not appearing in source code.

GetSpeculativeSymbolInfo(SemanticModel, Int32, AttributeSyntax)

Gets the corresponding SymbolInfo containing semantic info for specified AttributeSyntax at a given position, used in Semantic Info for items not appearing in source code.

GetSpeculativeSymbolInfo(SemanticModel, Int32, ExpressionSyntax, SpeculativeBindingOption)

Gets the corresponding SymbolInfo containing semantic info for a specified AttributeSyntax.

GetSpeculativeTypeInfo(SemanticModel, Int32, ExpressionSyntax, SpeculativeBindingOption)

Gets the corresponding TypeInfo containing semantic info for a speculating an ExpressionSyntax at a given position, used in Semantic Info for items not appearing in source code.

GetSymbolInfo(SemanticModel, AttributeSyntax, CancellationToken)

Gets the corresponding SymbolInfo containing semantic info for a specified AttributeSyntax.

GetSymbolInfo(SemanticModel, CrefReferenceSyntax, CancellationToken)

Gets the corresponding SymbolInfo containing semantic info for a specified CrefReferenceSyntax.

GetSymbolInfo(SemanticModel, ExpressionRangeVariableSyntax, CancellationToken)

Returns Select method associated with ExpressionRangeVariableSyntax within a LetClauseSyntax, or Microsoft.CodeAnalysis.SymbolInfo.None otherwise if none is.

GetSymbolInfo(SemanticModel, ExpressionSyntax, CancellationToken)

Gets the corresponding SymbolInfo containing semantic info for a specified ExpressionSyntax.

GetSymbolInfo(SemanticModel, FunctionAggregationSyntax, CancellationToken)

Returns aggregate function associated with FunctionAggregationSyntax.

GetSymbolInfo(SemanticModel, OrderingSyntax, CancellationToken)

Returns OrderBy/OrderByDescending/ThenBy/ThenByDescending method associated with OrderingSyntax.

GetSymbolInfo(SemanticModel, QueryClauseSyntax, CancellationToken)

Returns symbol information for a query clause.

GetTypeInfo(SemanticModel, AttributeSyntax, CancellationToken)

Gets the corresponding TypeInfo containing semantic info for a specified AttributeSyntax.

GetTypeInfo(SemanticModel, ExpressionSyntax, CancellationToken)
OptionCompareText(SemanticModel)

Gets the Semantic Model OptionCompareText property.

OptionExplicit(SemanticModel)

Gets the Semantic Model OptionExplicit property.

OptionInfer(SemanticModel)

Gets the Semantic Model OptionInfer property.

OptionStrict(SemanticModel)

Gets the Semantic Model OptionStrict property.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, AttributeSyntax, SemanticModel)

Gets the SemanticModel for a AttributeSyntax at a given position, used in Semantic Info for items not appearing in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, EqualsValueSyntax, SemanticModel)

Gets the SemanticModel for a EqualsValueSyntax at a given position, used in Semantic Info for items not appearing in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, ExecutableStatementSyntax, SemanticModel)

Gets the SemanticModel for a ExecutableStatementSyntax at a given position, used in Semantic Info for items not appearing in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, RangeArgumentSyntax, SemanticModel)

Gets the SemanticModel for a RangeArgumentSyntax at a given position, used in Semantic Info for items not appearing in source code.

TryGetSpeculativeSemanticModel(SemanticModel, Int32, TypeSyntax, SemanticModel, SpeculativeBindingOption)

Gets the SemanticModel for a TypeSyntax at a given position, used in Semantic Info for items not appearing in source code.

TryGetSpeculativeSemanticModelForMethodBody(SemanticModel, Int32, MethodBlockBaseSyntax, SemanticModel)

Gets the SemanticModel for a MethodBlockBaseSyntax at a given position, used in Semantic Info for items not appearing in source code.

Applies to