public static void Main() { bool validArg = NumberValidator.IsValid(typeof(Student), 19000); // false Console.WriteLine(validArg); validArg = NumberValidator.IsValid(typeof(Student), 25000); // true Console.WriteLine(validArg); }
public static void Main() { Student s = new Student(); bool validArg = NumberValidator.SetValidNumber(s, 19000); // false Console.WriteLine("Number {0} is valid? {1}", 1900, validArg); Console.WriteLine("Student number: {0}", s.Nr); validArg = NumberValidator.SetValidNumber(s, 25000); // true Console.WriteLine("Number {0} is valid? {1}", 25000, validArg); Console.WriteLine("Student number: {0}", s.Nr); }