generic
73 }
74 set
75 {
76 throw new Exception("The method or operation is not implemented.");77 }
78 }
79
generic
69 {
70 get
71 {
72 throw new Exception("The method or operation is not implemented.");73 }
74 set
75 {
generic
54 }
55 set
56 {
57 throw new Exception("The method or operation is not implemented.");58 }
59 }
60
generic
50 {
51 get
52 {
53 throw new Exception("The method or operation is not implemented.");54 }
55 set
56 {
generic
35 }
36 set
37 {
38 throw new Exception("The method or operation is not implemented.");39 }
40 }
41
The exception thrown is generic and defeats the purpose of exception handling. Each type of exception provides insight into what exactly went wrong and provides scenario-specific ways to recover gracefully. While it is easy to recover from some exceptions, a small subset of them make the recovery very difficult, usually because the conditions are not suitable for the program to continue executing. Be more specific about the exception types you throw.
if (n < 0)
{
throw new Exception("n cannot be < 0");
}
if (n < 0)
{
throw new ArgumentException("n cannot be < 0");
}