CSharp examples for Custom Type:Method Parameter
The ref modifier is essential in implementing a swap method
using System;/*from w w w . j a v a 2 s .c o m*/ class Test { static void Swap (ref string a, ref string b) { string temp = a; a = b; b = temp; } static void Main() { string x = "Penn"; string y = "Teller"; Swap (ref x, ref y); Console.WriteLine (x); // Teller Console.WriteLine (y); // Penn } }