I have the following public interface
public interface Bar{
public void DoStuff();
}
with an internal back end class
internal class BarImpl : Bar{
public void DoStuff(){
// throw exception if invalid state
// do something
}
}
The question:
- Only
BarImplimplements theBarinterface. BarImplcan throw exceptions in theDoStuffmethod.
Does it make sense to document these exceptions in the Bar.DoStuff xml doc?
Thanks in advance,
Yes – this would be the case even if
BarImplisn’t the only implementor.The example I like to use is the Stream class where the abstract Read method lists a whole load of exceptions that users of a
Streaminstance might expect to be thrown when using this method, and in turn the implementors of this class should throw under various scenarios.