I have a class, Solution. I use this class as a List which I don't want to grow unnecessarily.
I search the list to get a preexisting entry and return that -or- create a new entry if need be:
var s0 = _solutions.Where(x => x.strtId == strtNodeId && x.endId == endNodeId).ToList();
However, Linq will actually create new instances when where is true. But, as you might already see, that is not what I want.
The combination of x.startNode && x.endNode
is unique in all instances of _solution
At the end what I need is the reference to the one instance of _solution being searched for, if it already exists.
But what can I do aside from creating my own for loop/s?
Thanks.