sealed class Caller // can't be modified
{
public long Phone { get; set; }
}
static class Validator
{
public static Caller Validate(this Caller caller)
{
// I want to initialize this only once from a more elaborate source
HashSet<long> scammers = new() { 2345678901, 3456789012, 4567890123 };
if (scammers.Contains(caller.Phone)) throw new ArgumentException("known scammer");
return caller;
}
}