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

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -