ConditionalSetter

Generates a setter for a field, that only sets if a condition is met.

template ConditionalSetter (
alias field
string condition
AccessModifier access = AccessModifier.Protected
string name = field.stringof[1 .. $]
) {
enum ConditionalSetter;
}

Parameters

field

The field to generate the property for.

condition

The condition to evaluate when assigning.

access

The access modifier for the setter function.

name

The name of the property functions. Defaults to the field name minus the first character. Meant for fields that start with underscores.

Meta