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

        <legend id='sn7kI'><style id='sn7kI'><dir id='sn7kI'><q id='sn7kI'></q></dir></style></legend>
      1. 什么是动作&lt;字符串&gt;?

        What is Actionlt;stringgt;?(什么是动作lt;字符串gt;?)
          <bdo id='m4ZSK'></bdo><ul id='m4ZSK'></ul>

              1. <legend id='m4ZSK'><style id='m4ZSK'><dir id='m4ZSK'><q id='m4ZSK'></q></dir></style></legend>
              2. <tfoot id='m4ZSK'></tfoot>
                • <small id='m4ZSK'></small><noframes id='m4ZSK'>

                    <tbody id='m4ZSK'></tbody>
                • <i id='m4ZSK'><tr id='m4ZSK'><dt id='m4ZSK'><q id='m4ZSK'><span id='m4ZSK'><b id='m4ZSK'><form id='m4ZSK'><ins id='m4ZSK'></ins><ul id='m4ZSK'></ul><sub id='m4ZSK'></sub></form><legend id='m4ZSK'></legend><bdo id='m4ZSK'><pre id='m4ZSK'><center id='m4ZSK'></center></pre></bdo></b><th id='m4ZSK'></th></span></q></dt></tr></i><div id='m4ZSK'><tfoot id='m4ZSK'></tfoot><dl id='m4ZSK'><fieldset id='m4ZSK'></fieldset></dl></div>
                • 本文介绍了什么是动作&lt;字符串&gt;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  什么是Action<string>,怎么用?

                  推荐答案

                  Action 是一个标准委托,有 1 到 4 个参数(.NET 4 中为 16 个)并且不返回值.它用于表示一个动作.

                  Action is a standard delegate that has one to 4 parameters (16 in .NET 4) and doesn't return value. It's used to represent an action.

                  Action<String> print = (x) => Console.WriteLine(x);
                  
                  List<String> names = new List<String> { "pierre", "paul", "jacques" };
                  names.ForEach(print);
                  

                  还有其他预定义的委托:

                  There are other predefined delegates :

                  • 谓词,有一个参数并返回一个布尔值的委托.

                  • Predicate, delegate that has one parameter and returns a boolean.

                  Predicate<int> predicate = ((number) => number > 2);
                  var list = new List<int> { 1, 1, 2, 3 };
                  var newList = list.FindAll(predicate);
                  

                • Func 是更通用的一个,它有 1 到 4 个参数(.NET 4 中为 16 个)并返回一些东西

                • Func is the more generic one, it has 1 to 4 parameters (16 in .NET 4) and returns something

                  这篇关于什么是动作&lt;字符串&gt;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  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='iF4n7'></tbody>

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

                      <tfoot id='iF4n7'></tfoot>

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