开发者

How to execute function? which type of parameter should?

开发者 https://www.devze.com 2023-03-10 14:35 出处:网络
how to use following function public IList<T> GetAll(Expression<Func<T, bool>> whereCondition)

how to use following function

public IList<T> GetAll(Expression<Func<T, bool>> whereCondition)
{
     return this.ObjectSet.Where(whereCondition).ToList<T>();
}

like

_tabmasterS开发者_开发百科ervice.GetSingle( ... what should here.. );


_tabmasterService.GetAll(x => x.Name == "fred");


In your example a call to GetAll would look something like this

_tabmasterService.GetAll(x => x.SomeProperty == someValue);

This is a bit of syntactic sugar around delegates. You can read a bit more here.

0

精彩评论

暂无评论...
验证码 换一张
取 消