您的位置:首页 > 其它

how to pass a input parameter _HeaderToSearch in Predicate

2008-07-13 23:10 627 查看
Then, how to pass a input parameter _HeaderToSearch in Predicate?

1. To do that, we need to a new object called ListMatcher -

public class ListMatcher
{
private string _HeaderToSearch;
public ListMatcher(string headerToSearch)
{
_HeaderToSearch = headerToSearch;
}
public bool Predicate(SprintBacklogItem item)
{
return item.Title.StartsWith(_HeaderToSearch, StringComparison.InvariantCultureIgnoreCase);
}
}

2. Next , I initialized the ListMatcher object and use the HeaderToSearch to filter the items-

ListMatcher matcher = new ListMatcher("QA");
this.FindAll(matcher.Predicate);

Done.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: