For completeness of the answer to the original question, I propose the following, but I do not consider it readable, like using the foreach loop suggested by @ dog-las for updating. However, I have used this method of updating all objects in a collection using LINQ recently for an easier update, so find it convenient.
var result = distinctEdge.Select(c =>
{
c.value = EdgeList.Count(e => e.target == c.target
&& e.source == c.source);
return c;
}).ToList();
source
share