c# - Filtering a list of classes with LINQ -


i have list of class. need filter list using text.

class person {   string name;   int age; } 

i have list of person class

list<person> personlist; 

i have 100 values in personlist; need filter using text. wrote

this.personlist.where(item => item.name.contains(txtfilter.text)).tolist(); 

but not return expected result..can 1 me?

you need preserve result return linq statement in variable this

var filteredlist = this.personlist.where(item => item.name.contains(txtfilter.text)).tolist(); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -