Setter
A method or property part that changes a value, often checking it first.
What is Setter?
A setter is a method (or property part) that changes a value in an object. A good setter checks the new value before accepting it.
public int Temperature
{
get => temperature;
set
{
if (value < 5 || value > 30) throw new ArgumentOutOfRangeException(nameof(value));
temperature = value;
}
}
Level: Apprentice · More OOP terms at this level
Updated