What is the output of the following code?
using System; 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 ("this is a test", out a, out _); Console.WriteLine (a); Console.WriteLine (b); } }
Console.WriteLine (b); //compile time error
The code uses Out variables discards to ignore the second parameter.
b is not being set a value before using.