In .NET, what type of exception should be thrown if someone passes an illegal value to the set { }
part of a property?
Example:
public string Provider
{
get { return _provider; }
set
{
if (String.IsNullOrEmpty(value)) throw new Exception("Provider cannot be null or empty."); //what type of exception should be thrown here instead?
_provider = value;
}
}
Note:
I'm asking this question as it applies to .NET, but it could apply to many other languages as well. So if you have a good answer that applies to something other than the .NET framework, please post!