CSharp examples for Custom Type:Method Parameter
An out argument is like a ref argument, except it:
The out modifier is used to get multiple return values back from a method.
Like a ref parameter, an out parameter is passed by reference.
using System;/*from ww w.j av a 2 s . co m*/ class Test { static void Split (string name, out string firstNames, out string lastName) { int i = name.LastIndexOf (' '); firstNames = name.Substring (0, i); lastName = name.Substring (i + 1); } static void Main() { string a, b; Split ("Stevie Ray Vaughan", out a, out b); Console.WriteLine (a); // Stevie Ray Console.WriteLine (b); // Vaughan } }