Open sandboxFocus

Class ForwardConstructorStrategy

A standard IConstructorOverloadingStrategy implementation that generates a forwarding constructor for matching source constructors, optionally decorated with ObsoleteAttribute so that callers are encouraged to migrate from the original signature to the new one. Obtain instances via ForwardSourceConstructors or ForwardDefaultConstructor, and add the obsolete decoration by calling WithObsoleteAttribute(string?, bool).

Inheritance
ForwardConstructorStrategy
Namespace: Metalama.Framework.Advising
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public sealed class ForwardConstructorStrategy : IConstructorOverloadingStrategy, ICompileTimeSerializable

Methods

Name Description
WithObsoleteAttribute(string?, bool)

Returns a new ForwardConstructorStrategy that additionally decorates the generated forwarding constructor with ObsoleteAttribute, so that callers receive a compiler warning (or error) nudging them to migrate from the original signature to the new one. The scope (all source constructors vs the parameterless default constructor) is preserved.

Extension Methods

See Also