Based on that code:
List<StudentItem> searchlist = DataAccess.getallstudent(empdetails);
if (!string.IsNullOrEmpty(prefix))
{
for (int i = searchlist.Count - 1; i >= 0; i--)
{
StudenItem item = searchlist[i];
if (!item.LastName.StartsWith(prefix, StringComparison.CurrentCultureIgnoreCase))
{
searchlist.RemoveAt(i);
}
}
}
studentlist.ItemsSource = searchlist;
However, as I said
last time you posted this question[
^], it would be more efficient to pass the filter to the
getallstudent
method, and perform the filtering in the database. The only reason we can't tell you how to do that is that you haven't shown us the query you're using, nor described the structure of your tables.