G
Guest
Hi
I have a class which goes through its merry life as follows:
* it gets constructed,
* has some properties set,
* has some objects "added" by use of an "Add" method,
* has its "Go" method called,
* does its stuff, perhaps raising a few events,
* gets forgotten about and GCed.
When the "Go" method is called, it checks the parameters. They're not all passed as parameters to the Go method, but set before hand or "Add"ed.
My question is what type of exception should I raise if any of them are invalid, in the following scenarios:
* An object that has been added that is supposed to have sub-objects but doesn't?
* An object that has been added that is supposed to have equal numbers of two different types of subobjects but doesn't (think tables, source columns, dest columns)
* No objects have been added?
Does it actually matter if I use an 'InvalidOperationException' or an 'ArgumentNullException' or is there a better one?
I have a class which goes through its merry life as follows:
* it gets constructed,
* has some properties set,
* has some objects "added" by use of an "Add" method,
* has its "Go" method called,
* does its stuff, perhaps raising a few events,
* gets forgotten about and GCed.
When the "Go" method is called, it checks the parameters. They're not all passed as parameters to the Go method, but set before hand or "Add"ed.
My question is what type of exception should I raise if any of them are invalid, in the following scenarios:
* An object that has been added that is supposed to have sub-objects but doesn't?
* An object that has been added that is supposed to have equal numbers of two different types of subobjects but doesn't (think tables, source columns, dest columns)
* No objects have been added?
Does it actually matter if I use an 'InvalidOperationException' or an 'ArgumentNullException' or is there a better one?
