PublicApiType Class
A class, struct, interface, enum or delegate that is part of the public API.
public sealed class PublicApiType : PublicApiSymbolRemarks
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
PublicApiSymbolPublicApiType
Properties
| Name | Description |
|---|---|
| BaseType | Gets the base class. It is null for interfaces, and for System.Object. |
| DelegateInvokeMethod | Gets the Invoke method of a delegate type, which describes its signature. |
| EnumUnderlyingType | Gets the underlying type of an enum. |
| ExtensionBlocks | Gets the C# 14 extension blocks declared by a static class. Their members are not part of PublicApiType.Members, which contains their implementation methods. |
| FullName | Gets the metadata full name of the type, using + to separate nested types (e.g. System.Collections.Generic.Dictionary`2+Enumerator). |
| GenericParameters | Gets the generic parameters declared by this type. Nested types do not repeat the generic parameters of their containing types. |
| Interfaces | Gets the interfaces directly implemented by the type, sorted by documentation ID. Interfaces that are not visible outside the assembly are not included. |
| IsAbstract | Gets a value indicating whether the class is abstract. Interfaces and static classes are not reported as abstract. |
| IsClosed | Gets a value indicating whether the class is a closed class. |
| IsGenericType | |
| IsNew | 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. |
| IsReadOnly | Gets a value indicating whether the struct is a readonly struct. |
| IsRefLike | Gets a value indicating whether the struct is a ref struct. |
| IsSealed | Gets a value indicating whether the class is sealed. Structs, enums, delegates and static classes are not reported as sealed. |
| IsStatic | Gets a value indicating whether the type is a static class. |
| IsUnion | Gets a value indicating whether the struct is a C# union declaration. See PublicApiType.UnionCaseTypes. |
| Kind | |
| Members | 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. |
| MetadataName | Gets the name of the type including the generic arity suffix (e.g. List`1). |
| Namespace | Gets the namespace of the type. Nested types have the namespace of their top-level containing type. |
| NestedTypes | Gets the nested types, sorted by metadata name. |
| TypeKind | |
| UnionCaseTypes | Gets the case types of a C# union declaration. |
BaseType
PublicApiType.csGets the base class. It is null for interfaces, and for System.Object.
public PublicApiTypeReference? BaseType { get; }Property value
DelegateInvokeMethod
PublicApiType.csGets the Invoke method of a delegate type, which describes its signature.
public PublicApiMethod? DelegateInvokeMethod { get; }Property value
EnumUnderlyingType
PublicApiType.csGets the underlying type of an enum.
public PublicApiNamedTypeReference? EnumUnderlyingType { get; }Property value
ExtensionBlocks
PublicApiType.csGets 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; }Property value
FullName
PublicApiType.csGenericParameters
PublicApiType.csGets the generic parameters declared by this type. Nested types do not repeat the generic parameters of their containing types.
public ImmutableArray<PublicApiGenericParameter> GenericParameters { get; }Property value
Interfaces
PublicApiType.csGets 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; }Property value
IsAbstract
PublicApiType.csIsClosed
PublicApiType.csIsGenericType
PublicApiType.csIsNew
PublicApiType.csGets 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
IsReadOnly
PublicApiType.csIsRefLike
PublicApiType.csIsSealed
PublicApiType.csIsStatic
PublicApiType.csIsUnion
PublicApiType.csGets a value indicating whether the struct is a C# union declaration. See PublicApiType.UnionCaseTypes.
public bool IsUnion { get; }Property value
Kind
PublicApiType.csMembers
PublicApiType.csGets 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; }Property value
MetadataName
PublicApiType.csNamespace
PublicApiType.csNestedTypes
PublicApiType.csGets the nested types, sorted by metadata name.
public ImmutableArray<PublicApiType> NestedTypes { get; }Property value
TypeKind
PublicApiType.csUnionCaseTypes
PublicApiType.csGets the case types of a C# union declaration.
public ImmutableArray<PublicApiTypeReference> UnionCaseTypes { get; }Property value
Methods
| Name | Description |
|---|---|
| GetTypeAndNestedTypes() | Enumerates the type and all its nested types, recursively. |
GetTypeAndNestedTypes()
PublicApiType.csEnumerates the type and all its nested types, recursively.
public IEnumerable<PublicApiType> GetTypeAndNestedTypes()