INamedTypeSymbol Interface

Definition

Represents a type other than an array, a pointer, a type parameter.

public interface class INamedTypeSymbol : IEquatable<Microsoft::CodeAnalysis::ISymbol ^>, Microsoft::CodeAnalysis::ITypeSymbol
public interface INamedTypeSymbol : IEquatable<Microsoft.CodeAnalysis.ISymbol>, Microsoft.CodeAnalysis.ITypeSymbol
type INamedTypeSymbol = interface
    interface ITypeSymbol
    interface INamespaceOrTypeSymbol
    interface ISymbol
    interface IEquatable<ISymbol>
Public Interface INamedTypeSymbol
Implements IEquatable(Of ISymbol), ITypeSymbol
Derived
Implements

Remarks

This interface is reserved for implementation by its associated APIs. We reserve the right to change it in the future.

Properties

AllInterfaces

The list of all interfaces of which this type is a declared subtype, excluding this type itself. This includes all declared base interfaces, all declared base interfaces of base types, and all declared base interfaces of those results (recursively). This also is the effective interface set of a type parameter. Each result appears exactly once in the list. This list is topologically sorted by the inheritance relationship: if interface type A extends interface type B, then A precedes B in the list. This is not quite the same as "all interfaces of which this type is a proper subtype" because it does not take into account variance: AllInterfaces for IEnumerable<string> will not include IEnumerable<object>.

(Inherited from ITypeSymbol)
Arity

Returns the arity of this type, or the number of type parameters it takes. A non-generic type has zero arity.

AssociatedSymbol

For implicitly declared delegate types returns the EventSymbol that caused this delegate type to be generated. For all other types returns null. Note, the set of possible associated symbols might be expanded in the future to reflect changes in the languages.

BaseType

The declared base type of this type, or null. The object type, interface types, and pointer types do not have a base type. The base type of a type parameter is its effective base class.

(Inherited from ITypeSymbol)
CanBeReferencedByName

Returns true if this symbol can be referenced by its name in code.

(Inherited from ISymbol)
ConstructedFrom

Returns the type symbol that this type was constructed from. This type symbol has the same containing type (if any), but has type arguments that are the same as the type parameters (although its containing type might not).

Constructors

Get the both instance and static constructors for this type.

ContainingAssembly

Gets the IAssemblySymbol for the containing assembly. Returns null if the symbol is shared across multiple assemblies.

(Inherited from ISymbol)
ContainingModule

Gets the IModuleSymbol for the containing module. Returns null if the symbol is shared across multiple modules.

(Inherited from ISymbol)
ContainingNamespace

Gets the INamespaceSymbol for the nearest enclosing namespace. Returns null if the symbol isn't contained in a namespace.

(Inherited from ISymbol)
ContainingSymbol

Gets the ISymbol for the immediately containing symbol.

(Inherited from ISymbol)
ContainingType

Gets the INamedTypeSymbol for the containing type. Returns null if the symbol is not contained within a type.

(Inherited from ISymbol)
DeclaredAccessibility

Gets a Accessibility indicating the declared accessibility for the symbol. Returns NotApplicable if no accessibility is declared.

(Inherited from ISymbol)
DeclaringSyntaxReferences

Get the syntax node(s) where this symbol was declared in source. Some symbols (for example, partial classes) may be defined in more than one location. This property should return one or more syntax nodes only if the symbol was declared in source code and also was not implicitly declared (see the IsImplicitlyDeclared property).

Note that for namespace symbol, the declaring syntax might be declaring a nested namespace. For example, the declaring syntax node for N1 in "namespace N1.N2 {...}" is the entire NamespaceDeclarationSyntax for N1.N2. For the global namespace, the declaring syntax will be the CompilationUnitSyntax.

(Inherited from ISymbol)
DelegateInvokeMethod

For delegate types, gets the delegate's invoke method. Returns null on all other kinds of types. Note that it is possible to have an ill-formed delegate type imported from metadata which does not have an Invoke method. Such a type will be classified as a delegate but its DelegateInvokeMethod would be null.

EnumUnderlyingType

For enum types, gets the underlying type. Returns null on all other kinds of types.

HasUnsupportedMetadata

Indicates that this symbol uses metadata that cannot be supported by the language.

Examples include:

  • Pointer types in VB
  • ByRef return type
  • Required custom modifiers

This is distinguished from, for example, references to metadata symbols defined in assemblies that weren't referenced. Symbols where this returns true can never be used successfully, and thus should never appear in any IDE feature.

This is set for metadata symbols, as follows:

  • Type - if a type is unsupported (for example, a pointer type)
  • Method - parameter or return type is unsupported
  • Field - type is unsupported
  • Event - type is unsupported
  • Property - type is unsupported
  • Parameter - type is unsupported
(Inherited from ISymbol)
InstanceConstructors

Get the instance constructors for this type.

Interfaces

Gets the set of interfaces that this type directly implements. This set does not include interfaces that are base interfaces of directly implemented interfaces. This does include the interfaces declared as constraints on type parameters.

(Inherited from ITypeSymbol)
IsAbstract

Gets a value indicating whether the symbol is abstract.

(Inherited from ISymbol)
IsAnonymousType

Is this a symbol for an anonymous type (including anonymous VB delegate).

(Inherited from ITypeSymbol)
IsComImport

Specifies that the class or interface is imported from another module. See Import and ComImportAttribute

IsDefinition

Gets a value indicating whether the symbol is the original definition. Returns false if the symbol is derived from another symbol, by type substitution for instance.

(Inherited from ISymbol)
IsExtern

Gets a value indicating whether the symbol is defined externally.

(Inherited from ISymbol)
IsFileLocal

Indicates the type is declared in source and is only visible in the file it is declared in.

IsGenericType

True if this type or some containing type has type parameters.

IsImplicitClass

Returns true if the type is the implicit class that holds onto invalid global members (like methods or statements in a non script file).

IsImplicitlyDeclared

Returns true if this symbol was automatically created by the compiler, and does not have an explicit corresponding source code declaration.

(Inherited from ISymbol)
IsNamespace

Returns true if this symbol is a namespace. If it is not a namespace, it must be a type.

(Inherited from INamespaceOrTypeSymbol)
IsNativeIntegerType

True if the type represents a native integer. In C#, the types represented by language keywords 'nint' and 'nuint'.

(Inherited from ITypeSymbol)
IsOverride

Gets a value indicating whether the symbol is an override of a base class symbol.

(Inherited from ISymbol)
IsReadOnly

True if the type is readonly.

(Inherited from ITypeSymbol)
IsRecord

For source symbols, true if the type is a record. For metadata symbols, true if the type is a record and a reference type.

(Inherited from ITypeSymbol)
IsReferenceType

True if this type is known to be a reference type. It is never the case that IsReferenceType and IsValueType both return true. However, for an unconstrained type parameter, IsReferenceType and IsValueType will both return false.

(Inherited from ITypeSymbol)
IsRefLikeType

True if the type is ref-like, meaning it follows rules similar to CLR by-ref variables. False if the type is not ref-like or if the language has no concept of ref-like types.

(Inherited from ITypeSymbol)
IsScriptClass

Returns true if the type is a Script class. It might be an interactive submission class or a Script class in a csx file.

IsSealed

Gets a value indicating whether the symbol is sealed.

(Inherited from ISymbol)
IsSerializable

True if the type is serializable (has Serializable metadata flag).

IsStatic

Gets a value indicating whether the symbol is static.

(Inherited from ISymbol)
IsTupleType

Is this a symbol for a tuple .

(Inherited from ITypeSymbol)
IsType

Returns true if this symbols is a type. If it is not a type, it must be a namespace.

(Inherited from INamespaceOrTypeSymbol)
IsUnboundGenericType

True if this is a reference to an unbound generic type. A generic type is considered unbound if all of the type argument lists in its fully qualified name are empty. Note that the type arguments of an unbound generic type will be returned as error types because they do not really have type arguments. An unbound generic type yields null for its BaseType and an empty result for its Interfaces.

IsUnmanagedType

True if the type is unmanaged according to language rules. False if managed or if the language has no concept of unmanaged types.

(Inherited from ITypeSymbol)
IsValueType

True if this type is known to be a value type. It is never the case that IsReferenceType and IsValueType both return true. However, for an unconstrained type parameter, IsReferenceType and IsValueType will both return false.

(Inherited from ITypeSymbol)
IsVirtual

Gets a value indicating whether the symbol is virtual.

(Inherited from ISymbol)
Kind

Gets the SymbolKind indicating what kind of symbol it is.

(Inherited from ISymbol)
Language

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

(Inherited from ISymbol)
Locations

Gets the locations where the symbol was originally defined, either in source or metadata. Some symbols (for example, partial classes) may be defined in more than one location.

(Inherited from ISymbol)
MemberNames

Returns collection of names of members declared within this type.

MetadataName

Gets the name of a symbol as it appears in metadata. Most of the time, this is the same as the Name property, with the following exceptions:

  1. The metadata name of generic types includes the "`1", "`2" etc. suffix that indicates the number of type parameters (it does not include, however, names of containing types or namespaces).
  2. The metadata name of explicit interface names have spaces removed, compared to the name property.
  3. The length of names is limited to not exceed metadata restrictions.
(Inherited from ISymbol)
MetadataToken

Gets the metadata token associated with this symbol, or 0 if the symbol is not loaded from metadata.

(Inherited from ISymbol)
MightContainExtensionMethods

Determines if the symbol might contain extension methods. If false, the symbol does not contain extension methods.

Name

Gets the symbol name. Returns the empty string if unnamed.

(Inherited from ISymbol)
NativeIntegerUnderlyingType

If this is a native integer, returns the symbol for the underlying type, either IntPtr or UIntPtr. Otherwise, returns null.

NullableAnnotation

Nullable annotation associated with the type, or None if there are none.

(Inherited from ITypeSymbol)
OriginalDefinition

Get the original definition of this type symbol. If this symbol is derived from another symbol by (say) type substitution, this gets the original symbol, as it was defined in source or metadata.

SpecialType

An enumerated value that identifies certain 'special' types such as Object. Returns None if the type is not special.

(Inherited from ITypeSymbol)
StaticConstructors

Get the static constructors for this type.

TupleElements

Returns fields that represent tuple elements for types that are tuples.

If this type is not a tuple, then returns default.

TupleUnderlyingType

If this is a tuple type with element names, returns the symbol for the tuple type without names. Otherwise, returns null. The type argument corresponding to the type of the extension field (VT[8].Rest), which is at the 8th (one based) position is always a symbol for another tuple, rather than its underlying type.

TypeArgumentNullableAnnotations

Returns the top-level nullability of the type arguments that have been substituted for the type parameters. If nothing has been substituted for a given type parameter, then None is returned for that type argument.

TypeArguments

Returns the type arguments that have been substituted for the type parameters. If nothing has been substituted for a given type parameter, then the type parameter itself is considered the type argument.

TypeArgumentsNullableAnnotations

Returns the top-level nullability of the type arguments that have been substituted for the type parameters. If nothing has been substituted for a given type parameter, then NotApplicable is returned for that type argument.

TypeKind

An enumerated value that identifies whether this type is an array, pointer, enum, and so on.

(Inherited from ITypeSymbol)
TypeParameters

Returns the type parameters that this type has. If this is a non-generic type, returns an empty ImmutableArray.

Methods

Accept(SymbolVisitor) (Inherited from ISymbol)
Accept<TArgument,TResult>(SymbolVisitor<TArgument,TResult>, TArgument) (Inherited from ISymbol)
Accept<TResult>(SymbolVisitor<TResult>) (Inherited from ISymbol)
Construct(ImmutableArray<ITypeSymbol>, ImmutableArray<NullableAnnotation>)

Returns a constructed type given its type arguments and type argument nullable annotations.

Construct(ITypeSymbol[])

Returns a constructed type given its type arguments.

ConstructUnboundGenericType()

Returns an unbound generic type of this named type.

Equals(ISymbol, SymbolEqualityComparer)

Determines if this symbol is equal to another, according to the rules of the provided SymbolEqualityComparer

(Inherited from ISymbol)
FindImplementationForInterfaceMember(ISymbol)

Returns the corresponding symbol in this type or a base type that implements interfaceMember (either implicitly or explicitly), or null if no such symbol exists (which might be either because this type doesn't implement the container of interfaceMember, or this type doesn't supply a member that successfully implements interfaceMember).

(Inherited from ITypeSymbol)
GetAttributes()

Gets the attributes for the symbol. Returns an empty IEnumerable<T> if there are no attributes.

(Inherited from ISymbol)
GetDocumentationCommentId()

Returns the Documentation Comment ID for the symbol, or null if the symbol doesn't support documentation comments.

(Inherited from ISymbol)
GetDocumentationCommentXml(CultureInfo, Boolean, CancellationToken)

Gets the XML (as text) for the comment associated with the symbol.

(Inherited from ISymbol)
GetMembers()

Get all the members of this symbol.

(Inherited from INamespaceOrTypeSymbol)
GetMembers(String)

Get all the members of this symbol that have a particular name.

(Inherited from INamespaceOrTypeSymbol)
GetTypeArgumentCustomModifiers(Int32)

Returns custom modifiers for the type argument that has been substituted for the type parameter. The modifiers correspond to the type argument at the same ordinal within the TypeArguments array. Returns an empty array if there are no modifiers.

GetTypeMembers()

Get all the members of this symbol that are types.

(Inherited from INamespaceOrTypeSymbol)
GetTypeMembers(String)

Get all the members of this symbol that are types that have a particular name, of any arity.

(Inherited from INamespaceOrTypeSymbol)
GetTypeMembers(String, Int32)

Get all the members of this symbol that are types that have a particular name and arity

(Inherited from INamespaceOrTypeSymbol)
ToDisplayParts(NullableFlowState, SymbolDisplayFormat)

Converts a symbol to an array of string parts, each of which has a kind. Useful for colorizing the display string.

(Inherited from ITypeSymbol)
ToDisplayParts(SymbolDisplayFormat)

Convert a symbol to an array of string parts, each of which has a kind. Useful for colorizing the display string.

(Inherited from ISymbol)
ToDisplayString(NullableFlowState, SymbolDisplayFormat)

Converts an ITypeSymbol and a nullable flow state to a string representation.

(Inherited from ITypeSymbol)
ToDisplayString(SymbolDisplayFormat)

Converts the symbol to a string representation.

(Inherited from ISymbol)
ToMinimalDisplayParts(SemanticModel, Int32, SymbolDisplayFormat)

Convert a symbol to an array of string parts, each of which has a kind. May be tailored to a specific location in the source code. Useful for colorizing the display string.

(Inherited from ISymbol)
ToMinimalDisplayParts(SemanticModel, NullableFlowState, Int32, SymbolDisplayFormat)

Convert a symbol to an array of string parts, each of which has a kind. May be tailored to a specific location in the source code. Useful for colorizing the display string.

(Inherited from ITypeSymbol)
ToMinimalDisplayString(SemanticModel, Int32, SymbolDisplayFormat)

Convert a symbol to a string that can be displayed to the user. May be tailored to a specific location in the source code.

(Inherited from ISymbol)
ToMinimalDisplayString(SemanticModel, NullableFlowState, Int32, SymbolDisplayFormat)

Converts a symbol to a string that can be displayed to the user. May be tailored to a specific location in the source code.

(Inherited from ITypeSymbol)
WithNullableAnnotation(NullableAnnotation)

Returns the same type as this type but with the given nullable annotation.

(Inherited from ITypeSymbol)

Extension Methods

IsMustOverride(ISymbol)
IsNotOverridable(ISymbol)
IsOverridable(ISymbol)
IsOverrides(ISymbol)
IsShared(ISymbol)

Determines if symbol is Shared.

Applies to