It
appears that you just want (one of) the
foreach
statements to iterate over only the first two items of the collection. If that is your question, then just use the
.Take(2)
method on the collection in the statement. For example:
foreach (var item in flowBranches.Take(2))