将过滤器应用于业务对象

jes*_*ges -2 c#

有人可以帮我如何从业务对象中过滤数据吗?

这是我的示例代码:

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

这里allemps.Value是返回所有员工数据.但我想过滤emps其名称以"abc"开头的过滤器.我该怎么做呢?

Roa*_*oar 5

这里是对象示例的linq

var allemps = empService.GetAllEmployees();
IEnumerable<Emp> emps;
if (allemps.IsFreeOfErrors)
{
   emps = allemp.Where(w=>w.Value.StartWith("abc"));
}
Run Code Online (Sandbox Code Playgroud)