SemanticModel.LookupSymbols Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.ISymbol> LookupSymbols (int position, Microsoft.CodeAnalysis.INamespaceOrTypeSymbol container = default, string name = default, bool includeReducedExtensionMethods = false);
public System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.ISymbol> LookupSymbols (int position, Microsoft.CodeAnalysis.INamespaceOrTypeSymbol? container = default, string? name = default, bool includeReducedExtensionMethods = false);
member this.LookupSymbols : int * Microsoft.CodeAnalysis.INamespaceOrTypeSymbol * string * bool -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.ISymbol>
Public Function LookupSymbols (position As Integer, Optional container As INamespaceOrTypeSymbol = Nothing, Optional name As String = Nothing, Optional includeReducedExtensionMethods As Boolean = false) As ImmutableArray(Of ISymbol)
Parameters
- position
- Int32
The character position for determining the enclosing declaration scope and accessibility.
- container
- INamespaceOrTypeSymbol
The container to search for symbols within. If null then the enclosing declaration scope around position is used.
- name
- String
The name of the symbol to find. If null is specified then symbols with any names are returned.
- includeReducedExtensionMethods
- Boolean
Consider (reduced) extension methods.
Returns
A list of symbols that were found. If no symbols were found, an empty list is returned.
Remarks
The "position" is used to determine what variables are visible and accessible. Even if "container" is specified, the "position" location is significant for determining which members of "containing" are accessible.
Labels are not considered (see LookupLabels(Int32, String)).
Non-reduced extension methods are considered regardless of the value of includeReducedExtensionMethods
.