PublicApiExtensionBlock Class

A C# 14 extension block (e.g. extension<T>(List<T> list) { ... }) declared in a static class.

public sealed class PublicApiExtensionBlock

Remarks

The compiler emits each extension member twice: an implementation method on the static class, which is listed in PublicApiType.Members, and a member of an unspeakable grouping type that keeps the declaration as written in source. PublicApiExtensionBlock.Members contains the members as written in source. Use PublicApiMethod.ExtensionImplementation and PublicApiMethod.ImplementedExtensionMember to go from one to the other.

Properties

NameDescription
DeclaringTypeGets the static class that declares the extension block.
GenericParametersGets the type parameters of the block (e.g. T in extension<T>(List<T> list)).
GroupingTypeMetadataNameGets the metadata name of the compiler-generated grouping type (e.g. <G>$8048A6C8BE30A622530249B904B537EB). It is part of the documentation IDs of the PublicApiExtensionBlock.Members. Blocks with the same receiver type share it.
MarkerTypeMetadataNameGets the metadata name of the compiler-generated marker type (e.g. <M>$C43E2675C7BBF9284AF22FB8A9BF0280), which identifies the block in its grouping type.
MembersGets the members of the block, as written in source. Instance members have no receiver parameter and static members are PublicApiMember.IsStatic.
ReceiverGets the receiver parameter. Its PublicApiParameter.Name is null or empty when the block only declares static members (e.g. extension(string)).

Gets the static class that declares the extension block.

public PublicApiType DeclaringType { get; }

Property value

PublicApiType

Gets the type parameters of the block (e.g. T in extension<T>(List<T> list)).

public ImmutableArray<PublicApiGenericParameter> GenericParameters { get; }

GroupingTypeMetadataName

PublicApiExtensionBlock.cs

Gets the metadata name of the compiler-generated grouping type (e.g. <G>$8048A6C8BE30A622530249B904B537EB). It is part of the documentation IDs of the PublicApiExtensionBlock.Members. Blocks with the same receiver type share it.

public string GroupingTypeMetadataName { get; }

Property value

string

MarkerTypeMetadataName

PublicApiExtensionBlock.cs

Gets the metadata name of the compiler-generated marker type (e.g. <M>$C43E2675C7BBF9284AF22FB8A9BF0280), which identifies the block in its grouping type.

public string MarkerTypeMetadataName { get; }

Property value

string

Gets the members of the block, as written in source. Instance members have no receiver parameter and static members are PublicApiMember.IsStatic.

public ImmutableArray<PublicApiMember> Members { get; }

Gets the receiver parameter. Its PublicApiParameter.Name is null or empty when the block only declares static members (e.g. extension(string)).

public PublicApiParameter Receiver { get; }

Property value

PublicApiParameter

Methods

NameDescription
ToString()
public override string ToString()

Returns

string

No documentation is available.