14 Aralık 2017 Perşembe

passing by Reference & Output together in C#


using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace NewSandbox { class Program { static void YourMethod(ref int x, out int y) { x = 4; y = 6; } static void Main(string[] args) { int x =100, y = 200; YourMethod(ref 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