GOSHEWAN: A nebude to tim, ze "a.Node.Equals(agentUpdate.Node)" porovnava reference objektu, nikoliv jejich pozice? Cili ze tam mas dve ruzny instance popisujici ten samej node?
Imho by jsi tam mel mit spravne:
Func<INodeInformation, INodeInformation, bool> compareNodes = (_a, _b)=>{
if ( object.ReferenceEquals(_a, null) ) {
if ( object.ReferenceEquals(_b, null) ) { return true; }
else { return false; }
}
else if ( object.ReferenceEquals(_b, null) ) { return false; }
else { return _a.Layer == _b.Layer && _a.Row == _b.Row && _a.Column == _b.Column; }
};
deck.GetInitialisedAgents<IAgent>().Where(a => !compareNodes(a.Node, agentUpdate.Node)).OrderBy(a => a.Stack).Reverse().First();
btw. zapis ".OrderBy(a => a.Stack).Reverse().First();" bych vymenil bud za
a) ".OrderByDescending(a => a.Stack)First();"
b) ".OrderBy(a => a.Stack).Last();"