Problem with loop optimization or closure of lambda?
问题 In the following method I'm sending an enumeration of actions and want an array of ICommands back that call Action<object> that wrap those actions (needed for the relayCommand). The problem is that if I do this inside the for each (or even a for loop) I get commands that always execute the first action passed in the parameters. public static ICommand[] CreateCommands(IEnumerable<Action> actions) { List<ICommand> commands = new List<ICommand>(); Action[] actionArray = actions.ToArray(); //