Hello, Is it possible to use some kind of attribute to throw an exception. This is what I mean. Instead of doing this:
public int Age
{
get
{
return this.age;
}
set
{
this.age = value;
NotifyPropertyChanged("Age");
if (value < 18)
{
throw new Exception("age < 18");
}
}
}
Do something like this:
[Range(18,100, ErrorMessage="Must be older than 18")]
public int Age
{
get
{
return this.age;
}
set
{
this.age = value;
NotifyPropertyChanged("Age");
}
}
Any help would be greatly appreciated!
Best Regards, Kiril