PublicApiAssembly Class

The public API of an assembly, read from its metadata.

public sealed class PublicApiAssembly

Remarks

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

NameDescription
AttributesGets the custom attributes applied to the assembly.
CultureNameGets the culture of the assembly, or null for a culture-neutral assembly.
FullNameGets the display name of the assembly (e.g. MyLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null).
InputIdentityGets the identity of the input provided by PublicApiReadOptions.InputIdentity.
Module
NameGets the simple name of the assembly.
PublicKeyTokenGets the public key token as a lowercase hexadecimal string, or null when the assembly is not strong-named.
ScopeGets 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.
TargetFrameworkGets 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.
TargetFrameworkMonikerGets the value of the TargetFrameworkAttribute of the assembly (e.g. .NETCoreApp,Version=v8.0), or null when the assembly does not have it.
TypesGets the top-level types, sorted by namespace and metadata name. Nested types are available from PublicApiType.NestedTypes and PublicApiAssembly.GetAllTypes.
UsesUpdatedMemorySafetyRulesGets 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

Gets the custom attributes applied to the assembly.

public ImmutableArray<PublicApiAttribute> Attributes { get; }

Gets the culture of the assembly, or null for a culture-neutral assembly.

public string? CultureName { get; }

Property value

string?

Gets the display name of the assembly (e.g. MyLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null).

public string FullName { get; }

Property value

string

Gets the identity of the input provided by PublicApiReadOptions.InputIdentity.

public string? InputIdentity { get; }

Property value

string?

public PublicApiModule Module { get; }

Property value

PublicApiModule

No documentation is available.

Gets the simple name of the assembly.

public string Name { get; }

Property value

string

PublicKeyToken

PublicApiAssembly.cs

Gets the public key token as a lowercase hexadecimal string, or null when the assembly is not strong-named.

public string? PublicKeyToken { get; }

Property value

string?

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.

public string Scope { get; }

Property value

string

TargetFramework

PublicApiAssembly.cs

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.

public string? TargetFramework { get; }

Property value

string?

TargetFrameworkMoniker

PublicApiAssembly.cs

Gets the value of the TargetFrameworkAttribute of the assembly (e.g. .NETCoreApp,Version=v8.0), or null when the assembly does not have it.

public string? TargetFrameworkMoniker { get; }

Property value

string?

Gets 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; }

UsesUpdatedMemorySafetyRules

PublicApiAssembly.cs

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.

public bool UsesUpdatedMemorySafetyRules { get; }

Property value

bool

public Version Version { get; }

Property value

Version

No documentation is available.

Methods

NameDescription
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.cs

Finds 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

documentationId string

Returns

PublicApiSymbol? The symbol, or null when the assembly does not declare it.

FindType(string)

PublicApiAssembly.cs

Finds a type, including nested types, using its metadata full name (e.g. MyNamespace.MyType`1+NestedType).

public PublicApiType? FindType(string fullName)

Parameters

fullName string

Returns

PublicApiType? The type, or null when the assembly does not declare it.

GetAllSymbols()

PublicApiAssembly.cs

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.

public ImmutableArray<PublicApiSymbol> GetAllSymbols()

Enumerates all the types, including nested types. A nested type is enumerated after its containing type.

public IEnumerable<PublicApiType> GetAllTypes()
public override string ToString()

Returns

string

No documentation is available.