CSharp examples for Custom Type:Method Parameter
Demonstrate pass-by-reference semantics.
using System;/* w w w. ja v a 2s . c om*/ public class Program { public static void Update(ref int i, out double d) { i = 10; d = 20.0; } public static void Main(string[] args) { int i = 1; double d; Console.WriteLine("Before the call to Update(ref int, out double):"); Console.WriteLine("i = " + i + ", d is not initialized"); Update(ref i, out d); Console.WriteLine("After the call to Update(ref int, out double):"); Console.WriteLine("i = " + i + ", d = " + d); } }