Open sandboxFocus

Method WithObsoleteAttribute

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.

Declaration
public ForwardConstructorStrategy WithObsoleteAttribute(string? description = null, bool isError = false)
Parameters
Type Name Description
string description

Optional deprecation message displayed at the call site. When null, a bare [Obsolete] attribute is emitted.

bool isError

When true, calling the forwarding constructor is a compile-time error instead of a warning.

Returns
Type Description
ForwardConstructorStrategy