What is the output of the program


What is the output of the program below? Explain your answer. delegate void Printer(); static void Main() { List printers = new List(); for (int i = 0; i < 10; i++) { printers.Add(delegate { Console.WriteLine(i); }); } foreach (var printer in printers) { printer(); } }

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: What is the output of the program
Reference No:- TGS01507341

Now Priced at $20 (50% Discount)

Recommended (99%)

Rated (4.3/5)