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))();
Console.WriteLine();
// prints 'ba'
((Action)Delegate.Combine(b, a))();
}
}
No comments:
Post a Comment