C Sharp (C#) - Properties and Encapsulation
Examine this property setter:
What happens if the setter is called with an empty string?
private string _title;
public string Title {
get => _title;
set {
if (string.IsNullOrWhiteSpace(value))
throw new ArgumentException("Title cannot be empty");
_title = value;
}
}What happens if the setter is called with an empty string?
