How does Validator class work? - C#