C#C
C#3y ago
KQ

❔ Transform foreach to LINQ for optimization

is there a way to transform this logic from foreach to LINQ? I'm talking about the two foreaches. Thank you

List<JobEntity> JobsToSync = await this.JobsReppository.GetAllQueryable()
.Where(x => x.IsSyncedWithServer == false)
.ToListAsync();

foreach (JobEntity jobEntityToSync in JobsToSync) { List<PictureEntity> Images = jobEntityToSync.Images.ToList(); foreach (PictureEntity image in Images) { //some logic } }
Was this page helpful?