C # does not allow anything even remotely close to this type of dynamic behavior.
But you need to go this route, you can always use it dynamic, basically signaling to the compiler that all bets are disabled. This will work:
List<dynamic> list = new List<dynamic>(){foo, bar};
Assert.AreEqual(6, list[0].Invoke());
Assert.AreEqual(12, list[1].Invoke());
- , , list, Invoke.
, , TypeScript - , /, , , .
# , , , , .
- #, AFAIK.