Open sandboxFocus

Class ConstructorOverloadingStrategy

Provides factory access to the standard implementations of the IConstructorOverloadingStrategy interface. Each factory returns a ForwardConstructorStrategy whose WithObsoleteAttribute(string?, bool) method can be used to additionally decorate the generated forwarding constructor with ObsoleteAttribute.

Inheritance
ConstructorOverloadingStrategy
Namespace: Metalama.Framework.Advising
Assembly: Metalama.Framework.dll
Syntax
public static class ConstructorOverloadingStrategy

Properties

Name Description
ForwardDefaultConstructor

Gets a strategy that generates a forwarding constructor only when the mutated constructor is the parameterless constructor, if it exists. This is the typical choice for types that must remain constructible via CreateInstance<T>() or a new() generic constraint while the aspect enriches the constructor signature with additional parameters. Call WithObsoleteAttribute(string?, bool) on the returned instance to additionally decorate the generated forwarding constructor with ObsoleteAttribute.

ForwardSourceConstructors

Gets a strategy that generates a forwarding constructor for every source constructor that the framework mutates. Aspect-introduced constructors are not themselves overloaded. Call WithObsoleteAttribute(string?, bool) on the returned instance to additionally decorate the generated forwarding constructor with ObsoleteAttribute.

See Also