Translation of Java Error class to C#
-
I have to convert some Java code to C# and I've stumbled over the Error class. I have been told already that the use of Error instead of Exception allows to bypass catch-clauses for all Exceptions. Now C# doesn't have a direct equivalent to Error, AFAIK. Also at the place of the Error the internal state of the program is corrupted, so abortion makes sense. Am I supposed to use the Exception or even InvalidOperationException then?
-
I have to convert some Java code to C# and I've stumbled over the Error class. I have been told already that the use of Error instead of Exception allows to bypass catch-clauses for all Exceptions. Now C# doesn't have a direct equivalent to Error, AFAIK. Also at the place of the Error the internal state of the program is corrupted, so abortion makes sense. Am I supposed to use the Exception or even InvalidOperationException then?
jluber wrote:
Am I supposed to use the Exception or even InvalidOperationException then?
It doesnt matter, but a more specific Exception type is preferred. Main thing it to make a clear message so the user can see what went wrong.
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008) -
jluber wrote:
Am I supposed to use the Exception or even InvalidOperationException then?
It doesnt matter, but a more specific Exception type is preferred. Main thing it to make a clear message so the user can see what went wrong.
xacc.ide - now with TabsToSpaces support
IronScheme - 1.0 alpha 4a out now (29 May 2008)