How to filter the general list in .Net2.0?

I am using asp.net 2.0 and C #.

I have a general list,

List<EmployeeInfo> empInfoList; 

this list is loaded with employee information. Now I want to filter this list with the value of the text field. What is EmploeeName?

I need to filter this list with the name employeeName and bind it again to the gridview.

I am not sure how I can do this. Please, help.

Thanks in advance.

+4
source share
1 answer

Since you are using .Net2.0, you cannot use LINQ, however you can use the delegate and the FindAll method:

 string criteria = EmployeeName.Text.Trim().ToLower(); List<EmployeeInfo> resultList = empInfoList.FindAll( delegate(EmployeeInfo p) { return p.EmployeeName.ToLower().Contains(criteria); } ); 
+6
source

Source: https://habr.com/ru/post/1314732/


All Articles