1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
using System; class CloningTests { static Action a; static void Do (Action cb) { cb (); } static void SetupBAD () { int number = 0; Do(() => { a = () => Console.WriteLine ($"Number: {++number}"); }); } static void Main () { SetupBAD (); a (); } }