Answers for "how to use linq instead of foreach in c#"

C#
3

linq foreach c#

sequence.Where(x => x.Name.ToString().Equals("Apple"))
    .ToList()
    .ForEach( x =>
     {
       if(someCondition)
       {
         // Do some stuff here.
       }  
     });
Posted by: Guest on August-27-2020
1

foreach c# linq example

items.ToList().ForEach(i => i.DoStuff());
Posted by: Guest on October-18-2020
0

c# linq foreach example

myList.Where(l => l.Name.ToSting().Equals("Fortune")).ToList().ForEach(x => x.salary += deductions);
Posted by: Guest on December-06-2021

C# Answers by Framework

Browse Popular Code Answers by Language