// Passing By Output
// Passing by output is similar to Reference params. Except that Output params transmit data
// out of the method, not accept data in it. Passing by Output technic defined by "out" keyword.
// So you will use "out" keyword for this purpose.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NewSandbox
{
class Program
{
static void YourMethod(out int x, out int y)
{
x = 4;
y = 6;
}
static void Main(string[] args)
{
int x, y;
YourMethod(out x, out y);
Console.WriteLine(x); //output will be 4
Console.WriteLine(y); //output will be 6
Console.ReadKey();
}
}
}
Hiç yorum yok:
Yorum Gönder