Horje
c# break from foreach method Code Example
get out of foreach statement c#
foreach (string s in sList)
{
    if (s.equals("ok"))
    {
        break; // get out of the loop
    }
}
c# break from foreach method
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<T>(this IEnumerable<T> input, Action<T> 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.
}




Csharp

Related
C# int array initial values Code Example C# int array initial values Code Example
c# add 2 arrays Code Example c# add 2 arrays Code Example
on collision enter by layer 2d unity Code Example on collision enter by layer 2d unity Code Example
how to create public variable in c# Code Example how to create public variable in c# Code Example
c# add strings Code Example c# add strings Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10