Answers for "convert foreach to linq c#"

C#
2

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

convert foreach to linq c#

foreach (string field in fieldsList)
            {
                if (retrievedOrderLine.Attributes.Contains(field))
                {
                    orderLine[field] = retrievedOrderLine[field];
                }
            }
Posted by: Guest on July-22-2021
0

convert foreach to linq c#

foreach (var customer in customers)
            {
                customer.Email = !string.IsNullOrEmpty(customer.Name) && !string.IsNullOrEmpty(customer.Last) ? $"{customer.Name}.{customer.Last}{customer.Email.Substring(customer.Email.IndexOf("@"))}" : customer.Email;
            }
Posted by: Guest on December-24-2020

C# Answers by Framework

Browse Popular Code Answers by Language