Throw/do-not-throw an exception based on a parameter - why is this not a good idea?
问题 I was digging around in MSDN and found this article which had one interesting bit of advice: Do not have public members that can either throw or not throw exceptions based on some option. For example: Uri ParseUri(string uriValue, bool throwOnError) Now of course I can see that in 99% of cases this would be horrible, but is its occasional use justified? One case I have seen it used is with an "AllowEmpty" parameter when accessing data in the database or a configuration file. For example: