According to the documentation for IDataRecord, the implementing methods must throw IndexOutOfRangeException if the field index is out of the range of fields. However, if you try to throw an IndexOutOfRangeException directly in code, FXCop complains that it is a reserved exception type. How do you keep to the IDataRecord exception contract while still keeping FXCop happy?
views:
158answers:
1
+1
Q:
How do you implement IDataRecord properly if IndexOutOfRangeException is a reserved exception type?
+3
A:
Ignore FXCop in the case.
It's perfectly reasonable to throw IndexOutOfRangeException
when it's the most appropriate exception to throw - e.g. if you're implementing IList<T>
.
You might want to remove it from your FXCop configuration...
Jon Skeet
2009-08-21 11:01:49