foreach for list in c# code example
Example 1: how do i foreach c#
//No counter just the foreach.
//the HelloWorld is the Class objects name nor a public string can be used aswell.
foreach (string element in fibNumbers)
{
Console.WriteLine(element.HelloWorld);
}
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>
});