3 ms·
> checked excpetions should only be exceptions that a developer COULD handle and not ones that he can't And that's kinda the problem; you can declare the ones
by csharptwdec19 6y ago
> checked excpetions should only be exceptions that a developer COULD handle and not ones that he can't
And that's kinda the problem; you can declare the ones a user MIGHT be able to recover from, but there's still the chance of unrecoverable or unforseen errors, so you wind up declaring THROWS EXCEPTION anyway...
> in C# the library designers usually create a "Result" object that has a boolean of succeded or status of enum instead of using exceptions for failures. i.e. most i/o errors are not recoverable, thus c# does not enforce you to recover from them.
Depends on the operation but yes. Either There's a Try___ Pattern (where boolean is result, and 'out' parameter from method is your parsed value) or some will do an enumeration pattern.
Still, I'm a fan of Option for these sorts of things nowadays...