-2

Can someone help me how to filter data from business object?

Here is my sample code:

var allemps = empService.GetAllEmployees();
IEnumerable<Emp> emps;
if (allemps.IsFreeOfErrors)
{
       emps = allemps.Value.Contains("abc");
}

here allemps.Value is returning all employee data. But I want to filter emps whose name starts with "abc". How do I do this?

4

2 回答 2

5

这是linq to object 示例

var allemps = empService.GetAllEmployees();
IEnumerable<Emp> emps;
if (allemps.IsFreeOfErrors)
{
   emps = allemp.Where(w=>w.Value.StartWith("abc"));
}
于 2013-04-25T09:14:50.647 回答
2
emps = allemps.Where(e => e.Value.StartWith("abc"));
于 2013-04-25T09:14:59.903 回答