IntroductionDid you ever need your method return more than one value? The out keyword can be used to do the same. The out parameter can be used to return the values in the same variable passed as a parameter of the method. Any changes made to the parameter will be reflected in the variable. public class mathClass {public static int TestOut(out int iVal1, out int iVal2) {iVal1 = 10;iVal2 = 20;return 0;} public static void Main() {int i, j; // variable need not be initializedConsole.WriteLine(TestOut(out i, out j));Console.WriteLine(i);Console.WriteLine(j);}}
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: