Udostępnij przez


SemanticModel.GetDeclaredSymbolsCore(SyntaxNode, CancellationToken) Method

Definition

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:

  1. in the case of field declaration syntax nodes, which can declare multiple symbols, this method returns all declared symbols.
  2. in the case of type declarations with a primary constructor, both the INamedTypeSymbol for the type, and the IMethodSymbol for the primary constructor will be returned.
protected abstract System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.ISymbol> GetDeclaredSymbolsCore(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Threading.CancellationToken cancellationToken = default);
abstract member GetDeclaredSymbolsCore : Microsoft.CodeAnalysis.SyntaxNode * System.Threading.CancellationToken -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.ISymbol>
Protected MustOverride Function GetDeclaredSymbolsCore (declaration As SyntaxNode, Optional cancellationToken As CancellationToken = Nothing) As ImmutableArray(Of ISymbol)

Parameters

declaration
SyntaxNode

A syntax node that is a declaration. This can be any type derived from MemberDeclarationSyntax, TypeDeclarationSyntax, EnumDeclarationSyntax, NamespaceDeclarationSyntax, ParameterSyntax, TypeParameterSyntax, or the alias part of a UsingDirectiveSyntax

cancellationToken
CancellationToken

The cancellation token.

Returns

The symbols declared by the node.

Applies to