📅  最后修改于: 2022-03-11 14:49:03.555000             🧑  作者: Mango
list.Foreach((item) => {
// You cannot break from here beacuse of the structure of the method.
// Underneath is they way the meothd is tructured and a break is not allowed.
//public static ForEach(this IEnumerable input, Action action)
//{
//foreach(var i in input)
// action(i);
//}
});
// You have to convert your code into the traditional foreach:
foreach(var item in list) {
// Your code here
break; // <- As you can see you can break here.
}