c# - Treat a classes member as a type to use as a parameter in a search function -


i'm writing method searches list of person's matches based on single member of person class. i'd pass in person list (to search), matchpair list (for results), , specify member of person class going use search criteria.

public void matchwithsinglemember(list<matchpair> pairlist, list<person> personlist, ______ searchattribute)         {             (int = 0; < personlist.count; ++i)             {                 (int j = + 1; j < personlist.count; ++j)                 {                     if (personlist[i].searchmember == personlist[j].searchmember && personlist[i].searchmember != null)                     {                         matchpair matchpair = new matchpair(personlist[i], personlist[j]);                         pairlist.add(matchpair);                     }                 }             }         } 

this way, if wanted produce list of matches based of person class member: phone1, specify somehow parameter when calling above method.

matchwithsinglemember(results, listofpersons, __________); 

is there way this? please let me know if i'm not being clear enough.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -