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

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

php - Redirect and hide target URL -