SemanticModel.LookupNamespacesAndTypes Method

Definition

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.

public System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.ISymbol> LookupNamespacesAndTypes (int position, Microsoft.CodeAnalysis.INamespaceOrTypeSymbol container = default, string name = default);
public System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.ISymbol> LookupNamespacesAndTypes (int position, Microsoft.CodeAnalysis.INamespaceOrTypeSymbol? container = default, string? name = default);
member this.LookupNamespacesAndTypes : int * Microsoft.CodeAnalysis.INamespaceOrTypeSymbol * string -> System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.ISymbol>
Public Function LookupNamespacesAndTypes (position As Integer, Optional container As INamespaceOrTypeSymbol = Nothing, Optional name As String = Nothing) 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.

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.

Does not return INamespaceOrTypeSymbol, because there could be aliases.

Applies to