PublicApiType Class

A class, struct, interface, enum or delegate that is part of the public API.

public sealed class PublicApiType : PublicApiSymbol

Remarks

PublicApiType.Members contains the fields, properties, events, constructors, methods and operators that are visible outside the assembly (public, protected and protected internal), as well as explicit interface implementations. Members with unspeakable names generated by the compiler (e.g. <Clone>$), static constructors and accessors are not members; accessors are available from their property or event. Other compiler-generated members, such as the members of records, are included and can be identified with PublicApiSymbol.IsCompilerGenerated.

The members of a delegate are not exposed, except its Invoke method (see PublicApiType.DelegateInvokeMethod). C# 14 extension blocks are exposed through the static methods the compiler generates for them (e.g. get_Length(string)).

Inheritance
PublicApiSymbol PublicApiType

Properties

NameDescription
BaseTypeGets the base class. It is null for interfaces, and for System.Object.
DelegateInvokeMethodGets the Invoke method of a delegate type, which describes its signature.
EnumUnderlyingTypeGets the underlying type of an enum.
ExtensionBlocksGets the C# 14 extension blocks declared by a static class. Their members are not part of PublicApiType.Members, which contains their implementation methods.
FullNameGets the metadata full name of the type, using + to separate nested types (e.g. System.Collections.Generic.Dictionary`2+Enumerator).
GenericParametersGets the generic parameters declared by this type. Nested types do not repeat the generic parameters of their containing types.
InterfacesGets the interfaces directly implemented by the type, sorted by documentation ID. Interfaces that are not visible outside the assembly are not included.
IsAbstractGets a value indicating whether the class is abstract. Interfaces and static classes are not reported as abstract.
IsClosedGets a value indicating whether the class is a closed class.
IsGenericType
IsNewGets a value indicating whether the nested type hides a member its containing type inherits from a base type, that is visible outside its assembly (new in C#). The modifier is not stored in metadata, so it is inferred from the members of the base types. The base types that cannot be found are ignored.
IsReadOnlyGets a value indicating whether the struct is a readonly struct.
IsRefLikeGets a value indicating whether the struct is a ref struct.
IsSealedGets a value indicating whether the class is sealed. Structs, enums, delegates and static classes are not reported as sealed.
IsStaticGets a value indicating whether the type is a static class.
IsUnionGets a value indicating whether the struct is a C# union declaration. See PublicApiType.UnionCaseTypes.
Kind
MembersGets the members of the type: fields, properties, events, constructors, methods, operators, then conversion operators. The members of a kind are sorted by name, then by signature, so the order does not depend on the order of the declarations. Enum members are sorted by value, then by name.
MetadataNameGets the name of the type including the generic arity suffix (e.g. List`1).
NamespaceGets the namespace of the type. Nested types have the namespace of their top-level containing type.
NestedTypesGets the nested types, sorted by metadata name.
TypeKind
UnionCaseTypesGets the case types of a C# union declaration.

Gets the base class. It is null for interfaces, and for System.Object.

public PublicApiTypeReference? BaseType { get; }

DelegateInvokeMethod

PublicApiType.cs

Gets the Invoke method of a delegate type, which describes its signature.

public PublicApiMethod? DelegateInvokeMethod { get; }

Property value

PublicApiMethod?

EnumUnderlyingType

PublicApiType.cs

Gets the underlying type of an enum.

public PublicApiNamedTypeReference? EnumUnderlyingType { get; }

ExtensionBlocks

PublicApiType.cs

Gets the C# 14 extension blocks declared by a static class. Their members are not part of PublicApiType.Members, which contains their implementation methods.

public ImmutableArray<PublicApiExtensionBlock> ExtensionBlocks { get; }

Gets the metadata full name of the type, using + to separate nested types (e.g. System.Collections.Generic.Dictionary`2+Enumerator).

public string FullName { get; }

Property value

string

GenericParameters

PublicApiType.cs

Gets the generic parameters declared by this type. Nested types do not repeat the generic parameters of their containing types.

public ImmutableArray<PublicApiGenericParameter> GenericParameters { get; }

Gets the interfaces directly implemented by the type, sorted by documentation ID. Interfaces that are not visible outside the assembly are not included.

public ImmutableArray<PublicApiTypeReference> Interfaces { get; }

Gets a value indicating whether the class is abstract. Interfaces and static classes are not reported as abstract.

public bool IsAbstract { get; }

Property value

bool

Gets a value indicating whether the class is a closed class.

public bool IsClosed { get; }

Property value

bool

IsGenericType

PublicApiType.cs
public bool IsGenericType { get; }

Property value

bool

No documentation is available.

Gets a value indicating whether the nested type hides a member its containing type inherits from a base type, that is visible outside its assembly (new in C#). The modifier is not stored in metadata, so it is inferred from the members of the base types. The base types that cannot be found are ignored.

public bool IsNew { get; }

Property value

bool

Gets a value indicating whether the struct is a readonly struct.

public bool IsReadOnly { get; }

Property value

bool

Gets a value indicating whether the struct is a ref struct.

public bool IsRefLike { get; }

Property value

bool

Gets a value indicating whether the class is sealed. Structs, enums, delegates and static classes are not reported as sealed.

public bool IsSealed { get; }

Property value

bool

Gets a value indicating whether the type is a static class.

public bool IsStatic { get; }

Property value

bool

Gets a value indicating whether the struct is a C# union declaration. See PublicApiType.UnionCaseTypes.

public bool IsUnion { get; }

Property value

bool

public override PublicApiSymbolKind Kind { get; }

Property value

PublicApiSymbolKind

No documentation is available.

Gets the members of the type: fields, properties, events, constructors, methods, operators, then conversion operators. The members of a kind are sorted by name, then by signature, so the order does not depend on the order of the declarations. Enum members are sorted by value, then by name.

public ImmutableArray<PublicApiMember> Members { get; }

MetadataName

PublicApiType.cs

Gets the name of the type including the generic arity suffix (e.g. List`1).

public override string MetadataName { get; }

Property value

string

Gets the namespace of the type. Nested types have the namespace of their top-level containing type.

public string Namespace { get; }

Property value

string

NestedTypes

PublicApiType.cs

Gets the nested types, sorted by metadata name.

public ImmutableArray<PublicApiType> NestedTypes { get; }
public PublicApiTypeKind TypeKind { get; }

Property value

PublicApiTypeKind

No documentation is available.

UnionCaseTypes

PublicApiType.cs

Gets the case types of a C# union declaration.

public ImmutableArray<PublicApiTypeReference> UnionCaseTypes { get; }

Methods

NameDescription
GetTypeAndNestedTypes()Enumerates the type and all its nested types, recursively.

GetTypeAndNestedTypes()

PublicApiType.cs

Enumerates the type and all its nested types, recursively.

public IEnumerable<PublicApiType> GetTypeAndNestedTypes()