I want to write a series of delegates that call one another. It’s a bit like a multicast delegate, but not so — it’s “serial” a serial need. Internal logic in each delegate says that each subsequent call must come from the prior delegate and not from a marshalling mechanism.
Example:
[Test]
public void Test2() {
Action a = () => {
Action b = () => {
Action c = () => {
Console.WriteLine("test");
};
c.Invoke();
};
b.Invoke();
};
a.Invoke();
}
This looks possible via codegen, but I’d rather not do it that way.
Any ideas?
How about a linked list of delegates? Something like this:
This is just a quick draft, I haven’t actually compiled or run this code, but it should give you an idea.