是否可以在 C# 中创建匿名委托(delegate)列表?这是我很想写但无法编译的代码:
Action<int> method;
List<method> operations = new List<method>();
最佳答案
你可以这样写,比如
Action<int> method = j => j++;
List<Action<int>> operations = new List<Action<int>>();
operations.Add(method);
operations.Add(i => i++);
关于c# - List<T> 中 T 是匿名委托(delegate)的可能吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1449995/