c# for each element in list code example
Example 1: c# foreach
var numbers = new NumberList<int> { 0, 1, 2, 3, 4, 5 };
foreach (int num in numbers)
{
DoSomething();
}
Example 2: c# list foreach
someList.ForEach(x => { if(x.RemoveMe) someList.Remove(x); });
Example 3: c# list.foreach
List<string> someList = <some way to init>
someList.ForEach(delegate(string s) {
<process the string>
});