foreach list no repetition c# linq code example
Example 1: c# find duplicates in list
var query = lst.GroupBy(x => x)
.Where(g => g.Count() > 1)
.Select(y => y.Key)
.ToList();
Example 2: foreach c# linq example
items.ToList().ForEach(i => i.DoStuff());
Example 3: linq foreach c#
someValues.ToList().ForEach(x => list.Add(x + 1));