<i id='55jNi'><tr id='55jNi'><dt id='55jNi'><q id='55jNi'><span id='55jNi'><b id='55jNi'><form id='55jNi'><ins id='55jNi'></ins><ul id='55jNi'></ul><sub id='55jNi'></sub></form><legend id='55jNi'></legend><bdo id='55jNi'><pre id='55jNi'><center id='55jNi'></center></pre></bdo></b><th id='55jNi'></th></span></q></dt></tr></i><div id='55jNi'><tfoot id='55jNi'></tfoot><dl id='55jNi'><fieldset id='55jNi'></fieldset></dl></div>
      1. <tfoot id='55jNi'></tfoot>
          <bdo id='55jNi'></bdo><ul id='55jNi'></ul>
        <legend id='55jNi'><style id='55jNi'><dir id='55jNi'><q id='55jNi'></q></dir></style></legend>

      2. <small id='55jNi'></small><noframes id='55jNi'>

        代表:谓词 vs. 动作 vs. Func

        Delegates: Predicate vs. Action vs. Func(代表:谓词 vs. 动作 vs. Func)
        • <tfoot id='dNYbb'></tfoot>
            <tbody id='dNYbb'></tbody>

          • <legend id='dNYbb'><style id='dNYbb'><dir id='dNYbb'><q id='dNYbb'></q></dir></style></legend>
            <i id='dNYbb'><tr id='dNYbb'><dt id='dNYbb'><q id='dNYbb'><span id='dNYbb'><b id='dNYbb'><form id='dNYbb'><ins id='dNYbb'></ins><ul id='dNYbb'></ul><sub id='dNYbb'></sub></form><legend id='dNYbb'></legend><bdo id='dNYbb'><pre id='dNYbb'><center id='dNYbb'></center></pre></bdo></b><th id='dNYbb'></th></span></q></dt></tr></i><div id='dNYbb'><tfoot id='dNYbb'></tfoot><dl id='dNYbb'><fieldset id='dNYbb'></fieldset></dl></div>
            • <bdo id='dNYbb'></bdo><ul id='dNYbb'></ul>

                <small id='dNYbb'></small><noframes id='dNYbb'>

                  本文介绍了代表:谓词 vs. 动作 vs. Func的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  有人可以对这 3 位最重要的代表提供一个很好的解释(希望有例子):

                  Can someone provide a good explanation (hopefully with examples) of these 3 most important delegates:

                  • 谓词
                  • 行动
                  • 功能

                  推荐答案

                  • 谓词:本质上是Func;提出问题指定的参数是否满足委托所代表的条件?"用于 List.FindAll 之类的东西.

                    • Predicate: essentially Func<T, bool>; asks the question "does the specified argument satisfy the condition represented by the delegate?" Used in things like List.FindAll.

                      Action:给定参数执行一个动作.非常通用的用途.在 LINQ 中使用不多,因为它基本上意味着副作用.

                      Action: Perform an action given the arguments. Very general purpose. Not used much in LINQ as it implies side-effects, basically.

                      Func:在 LINQ 中广泛使用,通常用于转换参数,例如通过将复杂结构投影到一个属性.

                      Func: Used extensively in LINQ, usually to transform the argument, e.g. by projecting a complex structure to one property.

                      其他重要代表:

                      • EventHandler/EventHandler:在整个 WinForms 中使用

                      • EventHandler/EventHandler<T>: Used all over WinForms

                      Comparison<T>:与 IComparer 类似,但采用委托形式.

                      Comparison<T>: Like IComparer<T> but in delegate form.

                      这篇关于代表:谓词 vs. 动作 vs. Func的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                      本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Multicast delegate weird behavior in C#?(C# 中的多播委托奇怪行为?)
                  Parameter count mismatch with Invoke?(参数计数与调用不匹配?)
                  How to store delegates in a List(如何将代表存储在列表中)
                  How delegates work (in the background)?(代表如何工作(在后台)?)
                  C# Asynchronous call without EndInvoke?(没有 EndInvoke 的 C# 异步调用?)
                  Delegate.CreateDelegate() and generics: Error binding to target method(Delegate.CreateDelegate() 和泛型:错误绑定到目标方法)
                    <tbody id='k3TCq'></tbody>
                  <tfoot id='k3TCq'></tfoot>

                    1. <i id='k3TCq'><tr id='k3TCq'><dt id='k3TCq'><q id='k3TCq'><span id='k3TCq'><b id='k3TCq'><form id='k3TCq'><ins id='k3TCq'></ins><ul id='k3TCq'></ul><sub id='k3TCq'></sub></form><legend id='k3TCq'></legend><bdo id='k3TCq'><pre id='k3TCq'><center id='k3TCq'></center></pre></bdo></b><th id='k3TCq'></th></span></q></dt></tr></i><div id='k3TCq'><tfoot id='k3TCq'></tfoot><dl id='k3TCq'><fieldset id='k3TCq'></fieldset></dl></div>
                      <legend id='k3TCq'><style id='k3TCq'><dir id='k3TCq'><q id='k3TCq'></q></dir></style></legend>
                        • <bdo id='k3TCq'></bdo><ul id='k3TCq'></ul>

                          1. <small id='k3TCq'></small><noframes id='k3TCq'>