How to return more than one value from a method/function in c#? ans-using out keyword.
How to return more than one value from a method/function in c#? ans-using out keyword.
using System;
class test
{
public void caluculate(int x,int y, out int sum,out int mul)
{
sum=x+y;
mul=x*y;
}
public static void Main()
{
test t=new test();
int j,k;
t.caluculate(10,20,out j,out k);
Console.WriteLine(j);
Console.WriteLine(k);
Console.ReadLine();
}
}
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home