Also available at

Also available at my website and on Twitter @toshafanasiev

Wednesday 18 December 2013

I wanted to confirm the ordering of the invocation list of a multicast delegate created by concatenating two delegates so I put this quick test together. The results were reassuringly unsurprising:

using System;

static class prog
  static void Main()
    Action a = () => { Console.Write("a"); };
    Action b = () => { Console.Write("b"); };

    // prints 'ab'
    ((Action)Delegate.Combine(a, b))();


    // prints 'ba'
    ((Action)Delegate.Combine(b, a))();

No comments:

Post a Comment