static void Main(string[] args) { Cube c1 = new Cube(); Cube c2 = new Cube(); Cube c3 = new Cube(); MyDelegate d = c1.Next; d += c2.Next; d += c3.Next; Delegate[] arr = d.GetInvocationList(); Random R = new Random(); while(true) { ((MyDelegate)arr[R.Next(0, 3)])(); Print(c1, c2, c3); Console.ReadLine(); } }
public static void Print(Cube c1, Cube c2, Cube c3) { Console.WriteLine("{0} | {1} | {2}", c1.Value, c2.Value, c3.Value); }