Last post Nov 03, 2014 01:05 PM by PatriceSc
Nov 03, 2014 12:44 PM|Philosophaie|LINK
In vb.net there are the commands "Exit Sub" and "Goto". I can not find there analogous compatriots in c#.
Nov 03, 2014 12:57 PM|A2H|LINK
You to can use the return instead of ExitSub in c#
The return statement terminates execution of the method in which it appears and returns control to the calling method. It can also return an optional value. If the method is a void type,
the return statement can be omitted.
static double CalculateArea(int r)
double area = r * r * Math.PI;
You have the goto keyword in C# also.
Nov 03, 2014 12:58 PM|francissvk|LINK
exit sub - You can use
return for this purpose.
goto - Exists in C# already :
Nov 03, 2014 01:05 PM|PatriceSc|LINK
See http://msdn.microsoft.com/en-us/library/d96yfwee.aspx and in particular you'll find there the "return" and "goto" statements. The later one should be very rarely used. If used too much
it likely points to some kind of code design issue.