C# - Passing an Object Parameter into a list.Find function -
i writing find function list requires me pass in object parameter. reason find function uses variables in focused object (cfo) find next object (the x , y co-ordinates).
the find function looks first object can find within box region, using x,y of focused object create box region. problem having can not figure out how pass object in parameter find function.
does have solution? can't seem find on stackoverflow or google.
your question has quite deal of ambiguity (what suppose be) use of list<t>.find
method , custom find
method searches within list.
i think code may you:
public customobject find(list<customobject> list, customobject cfo) { return list.find(item => iswithinboxof(cfo, item)); } private bool iswithinboxof(customobject cfo, customobject item) { // return whether item within box of cfo. return item.x <= cfo.x + 1 && item.y <= cfo.y + 1; }
Comments
Post a Comment