Open sandboxFocus

Interface IRecordBuilder

Allows to complete the construction of a record that has been created by the IntroduceRecord(IAdviser<INamespaceOrNamedType>, string, RecordKind, OverrideStrategy, Action<IRecordBuilder>?) advice. One interface serves a record class and a record struct.

Namespace: Metalama.Framework.Code.DeclarationBuilders
Assembly: Metalama.Framework.dll
Syntax
[InternalImplement]
public interface IRecordBuilder : INamedTypeBuilder, IMemberOrNamedTypeBuilder, IDeclarationBuilder, INamedType, IType, IEquatable<IType>, IGeneric, IMemberOrNamedType, INamespaceOrNamedType, INamedDeclaration, IDeclaration, IDisplayable, IDiagnosticLocation, ICompilationElement, IMeasurable, IEquatable<IDeclaration>, IEquatable<INamedType>
Remarks

The authoring form is chosen when the advice is called and is reported by RecordKind.

The members that the compiler synthesizes for a record are not set through this interface. They are created by the advice and are read through Facets on the introduced type, as they are for a record that the user wrote.

Properties

Name Description
PositionalParameters

Gets the positional parameters that have been added so far, in the order in which they were added.

RecordKind

Gets the authoring form of the record, which was chosen when the advice was called.

Methods

Name Description
AddBaseArgument(IExpression, string?)

Adds an argument that the record passes to the primary constructor of its base record, which the language writes in the base list of the declaration, as in record Derived( int X ) : BaseRecord( X ).

AddPositionalParameter(string, IType, TypedConstant?)

Appends a positional parameter to the record, which declares a parameter of the primary constructor and a public init-only property of the same name and type.

AddPositionalParameter(string, Type, TypedConstant?)

Appends a positional parameter to the record, which declares a parameter of the primary constructor and a public init-only property of the same name and type.

Extension Methods

See Also