A challenge for us... for you I mean lol! Can anyone of you have any idea on how to make an equivalent code of On Error Resume Next of VB to C#?.

Note: Don't use a try catch



>Note: Don't use a try catch
Erm, why? On Error is generally considered to be a huge wart of VB, so why would you want to avoid the superior equivalent in C# and try to emulate it?

ok... you can use a try catch but what if i have 100 lines of code, you mean to say you have to try catch it in 100 times? or arrrgggghhhh! please see below sample.

private int Calculate(int x, int y)
     return Calculate

My problem is we don't know what line will the error occur. suppose the error will be in x=x+y; so it will resume in y=y-x; or the error will be in y=y-x; and again it must resume in Calculate=x+y;
and please don't ask me why it must resume...Just help me to this issue please... that it must resume to next statement if there's an error...


This article has been dead for over six months. Start a new discussion instead.