how to use foreach on linq code example
Example 1: linq foreach c#
sequence.Where(x => x.Name.ToString().Equals("Apple"))
.ToList()
.ForEach( x =>
{
if(someCondition)
{
// Do some stuff here.
}
});
Example 2: linq foreach c#
someValues.ToList().ForEach(x => list.Add(x + 1));