gpt4 book ai didi

c# - 过滤器需要通过引用传递才能附加到它

转载 作者:太空宇宙 更新时间:2023-11-03 22:30:03 25 4
gpt4 key购买 nike

<分区>

我想了解为什么 Expression<Func<SomeObject, bool>>过滤器需要通过引用传递。

这是一个对象,默认情况下应由 c# 中的 ref 传递。

Expression<Func<SomeObject,bool>> filter = PredicateBuilder.New<SomeObject>(true);


//Function that builds the filter
void buildFilter(ref Expression<Func<SomeObject, bool>> filter){
filter = filter.And(x => x.SomeProperty == sth);
...builds filter. }

这是什么以及为什么我们需要这样处理它?<​​/p>

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com