Open sandboxFocus

Interface IDelegateBuilder

Allows to complete the construction of a delegate that has been created by the IntroduceDelegate(IAdviser<INamespaceOrNamedType>, string, Action<IDelegateBuilder>, OverrideStrategy) advice.

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

This interface derives from IMemberOrNamedTypeBuilder and declares the members of a signature itself. A delegate declaration is a method signature preceded by the delegate keyword, so the return type, the return parameter and the parameters describe the Invoke method that the compiler synthesizes, while the name, the accessibility, the custom attributes and the type parameters describe the delegate type.

The following inherited properties are not valid for a delegate, and their setter throws a NotSupportedException: IsStatic, IsSealed, IsAbstract and IsPartial. A delegate is implicitly sealed, and it is never static, abstract or partial.

A delegate builder is not an INamedType, so it may not be used where an IType is expected. The introduced delegate is read from Declaration, which is how an aspect gives it as the type of a field, of a property or of an event.

The BeginInvoke and EndInvoke methods are neither exposed nor built. They exist only for a delegate compiled for .NET Framework, and they are the asynchronous pattern that preceded async.

Properties

Name Description
Parameters

Gets the parameters of the delegate, in the order in which they were added.

ReturnParameter

Gets the return parameter of the delegate, which carries the reference kind of a ref return and the custom attributes of the return value.

ReturnType

Gets or sets the return type of the delegate. The default value is void.

TypeParameters

Gets the type parameters of the delegate, in the order in which they were added.

Methods

Name Description
AddParameter(string, IType, RefKind, TypedConstant?)

Appends a parameter to the delegate.

AddParameter(string, Type, RefKind, TypedConstant?)

Appends a parameter to the delegate.

AddTypeParameter(string)

Appends a type parameter to the delegate.

Extension Methods

See Also