public IEnumerable GetErrors(string propertyName) { switch (propertyName) { case nameof(Text): return Required && string.IsNullOrWhiteSpace(Text) ? new[] { "Required value" } : null; default: return null; } }