How to avoid argument validation
问题 Validating Primitive Arguments and "Complex Data" Validating Arguments When writing a method, arguments should be validated first before any operations are performed. For example, let's say we've got a class representing people: public class Person { public readonly string Name; public readonly int Age; public class Person(string name, int age) { this.Name = name; this.Age = age; } } What's wrong with this Person class? name and age aren't validated before their values are set as fields of