Software Development Network>> VS Express Editions>> VC# Exit Sub Equivalent
Ryan,
That's what 'return' does. In the example above, the Console.WriteLine statement will not be run if value is equal to null or is an empty string (ie has a length of 0).
Similar to VB.NET, C# uses return, for example:
VB Sub Equivalent:
VB Function Equivalent:
VC# Exit Sub Equivalent
Krad
Ryan,
That's what 'return' does. In the example above, the Console.WriteLine statement will not be run if value is equal to null or is an empty string (ie has a length of 0).
darentan
Thanks for your response.
I was hoping to find something in VC# that stopped the procedure/function running after when it's Exit Sub equivalent was called.
Eg...
public void Testing(string value)
{
if (value == null || value.Length == 0)
Exit Sub;
// anything else below this is not run
Console.WriteLine(value);
}
Thanks,
Ryan
Willis777
Ryan,
Similar to VB.NET, C# uses return, for example:
VB Sub Equivalent:
public void WriteLine(string value)
{
if (value == null || value.Length == 0)
return;
Console.WriteLine(value);
}
VB Function Equivalent:
public string Concat(string value1, string value2)
{
if (value1 == null || value1.Length == 0)
return value2;
if (value2 == null || value2.Length == 0)
return value1;
return value1 + ":" + value2;
}
c3
Thanks David.