PublicApiAssembly Class
The public API of an assembly, read from its metadata.
public sealed class PublicApiAssemblyRemarks
The model only contains data decoded from metadata: it does not reference the file, the stream or the metadata reader used to create it, and it remains valid after they are disposed. Reading an assembly never loads or executes it, nor the assemblies it references.
Properties
| Name | Description |
|---|---|
| Attributes | Gets the custom attributes applied to the assembly. |
| CultureName | Gets the culture of the assembly, or null for a culture-neutral assembly. |
| FullName | Gets the display name of the assembly (e.g. MyLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null). |
| InputIdentity | Gets the identity of the input provided by PublicApiReadOptions.InputIdentity. |
| Module | |
| Name | Gets the simple name of the assembly. |
| PublicKeyToken | Gets the public key token as a lowercase hexadecimal string, or null when the assembly is not strong-named. |
| Scope | Gets the scope of the symbols of this assembly, used by PublicApiSymbol.Identity. It is PublicApiAssembly.InputIdentity when provided. Otherwise, it is made of the assembly display name and of the module version ID, so it changes when the assembly is rebuilt with different inputs. It never contains a file path. |
| TargetFramework | Gets the target framework of the assembly. It is the value provided by PublicApiReadOptions.TargetFramework, unchanged, or the short name inferred from the TargetFrameworkAttribute of the assembly (e.g. net8.0). It is null when it is unknown. |
| TargetFrameworkMoniker | Gets the value of the TargetFrameworkAttribute of the assembly (e.g. .NETCoreApp,Version=v8.0), or null when the assembly does not have it. |
| Types | Gets the top-level types, sorted by namespace and metadata name. Nested types are available from PublicApiType.NestedTypes and PublicApiAssembly.GetAllTypes. |
| UsesUpdatedMemorySafetyRules | Gets a value indicating whether the assembly is compiled with the updated memory safety rules. In this case, PublicApiMember.RequiresUnsafe reports the members the compiler marked as requiring an unsafe context. |
| Version |
Attributes
PublicApiAssembly.csGets the custom attributes applied to the assembly.
public ImmutableArray<PublicApiAttribute> Attributes { get; }Property value
CultureName
PublicApiAssembly.csFullName
PublicApiAssembly.csInputIdentity
PublicApiAssembly.csGets the identity of the input provided by PublicApiReadOptions.InputIdentity.
public string? InputIdentity { get; }Property value
Module
PublicApiAssembly.csPublicKeyToken
PublicApiAssembly.csScope
PublicApiAssembly.csGets the scope of the symbols of this assembly, used by PublicApiSymbol.Identity. It is PublicApiAssembly.InputIdentity when provided. Otherwise, it is made of the assembly display name and of the module version ID, so it changes when the assembly is rebuilt with different inputs. It never contains a file path.
public string Scope { get; }Property value
TargetFramework
PublicApiAssembly.csGets the target framework of the assembly. It is the value provided by PublicApiReadOptions.TargetFramework, unchanged, or the short name inferred from the TargetFrameworkAttribute of the assembly (e.g. net8.0). It is null when it is unknown.
public string? TargetFramework { get; }Property value
TargetFrameworkMoniker
PublicApiAssembly.csTypes
PublicApiAssembly.csGets the top-level types, sorted by namespace and metadata name. Nested types are available from PublicApiType.NestedTypes and PublicApiAssembly.GetAllTypes.
public ImmutableArray<PublicApiType> Types { get; }Property value
UsesUpdatedMemorySafetyRules
PublicApiAssembly.csGets a value indicating whether the assembly is compiled with the updated memory safety rules. In this case, PublicApiMember.RequiresUnsafe reports the members the compiler marked as requiring an unsafe context.
public bool UsesUpdatedMemorySafetyRules { get; }Property value
Version
PublicApiAssembly.csMethods
| Name | Description |
|---|---|
| FindSymbolByDocumentationId(string) | Finds a type, a member or an accessor using its XML documentation ID (e.g. M:MyNamespace.MyType.MyMethod(System.Int32)). |
| FindType(string) | Finds a type, including nested types, using its metadata full name (e.g. MyNamespace.MyType`1+NestedType). |
| GetAllSymbols() | Gets all the symbols: types, members, accessors, delegate Invoke methods and the members of C# 14 extension blocks (see PublicApiType.ExtensionBlocks). A symbol is listed after its declaring type. |
| GetAllTypes() | Enumerates all the types, including nested types. A nested type is enumerated after its containing type. |
| ToString() |
FindSymbolByDocumentationId(string)
PublicApiAssembly.csFinds a type, a member or an accessor using its XML documentation ID (e.g. M:MyNamespace.MyType.MyMethod(System.Int32)).
public PublicApiSymbol? FindSymbolByDocumentationId(string documentationId)Parameters
documentationIdstring
Returns
PublicApiSymbol? The symbol, or null when the assembly does not declare it.
FindType(string)
PublicApiAssembly.csFinds a type, including nested types, using its metadata full name (e.g. MyNamespace.MyType`1+NestedType).
public PublicApiType? FindType(string fullName)Parameters
fullNamestring
Returns
PublicApiType? The type, or null when the assembly does not declare it.
GetAllSymbols()
PublicApiAssembly.csGets all the symbols: types, members, accessors, delegate Invoke methods and the members of C# 14 extension blocks (see PublicApiType.ExtensionBlocks). A symbol is listed after its declaring type.
public ImmutableArray<PublicApiSymbol> GetAllSymbols()GetAllTypes()
PublicApiAssembly.csEnumerates all the types, including nested types. A nested type is enumerated after its containing type.
public IEnumerable<PublicApiType> GetAllTypes()