Good Morning
Lets I want to validate something inside a property...
private string _phoneType;
public string PhoneType
{
get
{
return _phoneType;
}
set
{
_phoneType = value;
}
}
valid values for PhoneType are: "Home", "Mobile" and "Work". If an invalid value
is supplied, an ArgumentOutOfRangeException must be thrown using the 5th
overload with 3 parameters, with meaningful messages
Please explain what that above statement mean.
Loading

Vishal GilbileRank #268 · 9.4K reputationPosted Apr 23, 2013, 12:33 AM EDT
Try the following Code.
Emile De wilde2 reputationPosted Apr 24, 2013, 6:31 AM EDT
VulpesRank #55 · 29.2K reputationPosted Apr 24, 2013, 7:06 AM EDT
http://msdn.microsoft.com/en-US/library/system.argumentexception.argumentexception(v=vs.110).aspx
So, I think what's needed is something like this:
private string _phoneType;