与谓词非常相似的东西,但不是谓词(Something very similar to predicate, but not a predicate)
我希望有一个“谓词”(它在引号中,因为我不知道正确的单词),它根据条件返回对象的不同字段。 我希望一个简短的例子可以说明。
Predicate<MyClass> predicate if (condition1) predicate = x => x.Field1; else if (condition2) predicate = x => x.Field2; foreach(vat item in ListOfItems) { predicate(item) = someValue;//Here I am changing the value of that field. }
I want to have a "predicate" (it's in quotes, since I don't know the right word), that returns different fields of an object, based on conditions. I hope a short example will illustrate.
Predicate<MyClass> predicate if (condition1) predicate = x => x.Field1; else if (condition2) predicate = x => x.Field2; foreach(vat item in ListOfItems) { predicate(item) = someValue;//Here I am changing the value of that field. }
原文:https://stackoverflow.com/questions/19744023
更新时间:2021-12-02 13:12
最满意答案
你可以使用
null
作为参数:endfun(null);
you can use
null
as the parameter:endfun(null);
相关问答
更多-
您可以使用文档就绪事件来加载其余内容: $(document).ready(function() { // your code }); Seems I solved my problem by assigning the php code to a smaller div than originally planned. I can't assign it to the page id, but to a smaller div within the page. The odd thing is ...
-
你快到了。 在您的代码中,参数div被转换为字符串。 而不是那样,尝试下面给出的代码,