当前位置: 首页 > news >正文

鱼台县建设局网站网络推广员的工作内容

鱼台县建设局网站,网络推广员的工作内容,广州网站推广团队,昆山有建设网站的吗Action<>是.NET Framework中自带的泛型委托&#xff0c;可以接收一个或多个输入参数&#xff0c;但不返回任何参数&#xff0c;可传递至多16种不同类型的参数类型。在Linq的一些方法上使用的比较多。 1、Action泛型委托 .NET Framework为我们提供了多达16个参数的Action…

Action<>是.NET Framework中自带的泛型委托,可以接收一个或多个输入参数,但不返回任何参数,可传递至多16种不同类型的参数类型。在Linq的一些方法上使用的比较多。

 

1、Action泛型委托

.NET Framework为我们提供了多达16个参数的Action委托定义,对于常见的开发场景已经完全够用。

如下图,

示例说明:

Action<>:委托至少0个参数,至多16个参数,无返回值。

Action:表示无参,无返回值的委托。

Action :表示有传入参数int,string无返回值的委托。

Action:表示有传入参数int,string,bool无返回值的委托。

Action:表示有传入4个int型参数,无返回值的委托。

2、Action泛型委托的使用

Action泛型委托的使用方法,可以通过下面代码看一下,

例如,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ActionDemo
{class Program{static void Main(string[] args){// 无参数无返回值的委托Action action1 = new Action(ActionWithNoParaNoReturn);action1();Console.WriteLine("----------------------------");// 使用delegateAction action2 = delegate { Console.WriteLine("使用delegate"); };// 执行action2();Console.WriteLine("----------------------------");// 使用匿名委托Action action3 = () => { Console.WriteLine("匿名委托"); };action3();Console.WriteLine("----------------------------");// 有参数无返回值的委托Action<int> action4 = new Action<int>(ActionWithPara);action4(11);Console.WriteLine("----------------------------");// 使用delegateAction<int> action5 = delegate (int i) { Console.WriteLine($"使用delegate的委托,参数值是:{i}"); };action5(22);Console.WriteLine("----------------------------");// 使用匿名委托Action<string> action6 = (string s) => { Console.WriteLine($"使用匿名委托,参数值是:{s}"); };action6("C#");Console.WriteLine("----------------------------");// 多个参数无返回值的委托Action<int,string> action7 = new Action<int,string>(ActionWithMulitPara);action7(33, "Java");Console.WriteLine("----------------------------");// 使用delegateAction<int,int,string> action8 = delegate (int i1, int i2, string s) {Console.WriteLine($"三个参数的Action委托,参数1的值是:{i1},参数2的值是:{i2},参数3的值是:{s}");};action8(44, 55, "Python");Console.WriteLine("----------------------------");Action<int,int,string,string> action9 = (int i1,int i2, string s1,string s2) => {Console.WriteLine($"使用四个参数的委托,参数1的值是:{i1},参数2的值是:{i2},参数3的值是:{s1},参数4的值是:{s2}");};// 执行委托action9(66,77, "C","CJavaPy");Console.ReadKey();}static void ActionWithNoParaNoReturn(){Console.WriteLine("无参数无返回值的Action委托");}static void ActionWithPara(int i){Console.WriteLine($"有参数无返回值的委托,参数值是:{i}");}static void ActionWithMulitPara(int i,string s){Console.WriteLine($"有两个参数无返回值的委托,参数1的值是:{i},参数2的值是:{s}");}}
}

 

http://www.wangmingla.cn/news/12766.html

相关文章:

  • 策划对于企业网站建设来说郑州搜索引擎优化
  • 网站设计确认书对seo的认识和理解
  • 做网站哪个简单点厦门seo哪家强
  • 网站开发中期检查什么是百度指数
  • php免费源码网站廊坊自动seo
  • 个人做网站的必要性要做网络推广
  • 一个微信可以做两个网站支付宝北京网络seo
  • 建设高端网站公司的目的湖南网站seo推广
  • 市政道路毕业设计代做网站成都网络推广公司
  • 做seo的网站市场调研问卷调查怎么做
  • 做外贸的人常用的网站引擎搜索大全
  • 推荐10个网站nba新闻最新消息
  • 男女在床上做孔网站如何制作一个网页网站
  • 做网站基本费用大概需要多少电商seo优化是什么
  • 怎样做天猫 淘宝网站导购网站搭建服务
  • 如何做医药类网站网络项目免费的资源网
  • 手机网站赏析百度网络小说排行榜
  • 做网站用的图片分辨率营销存在的问题及改进
  • 南京优化网站上海何鹏seo
  • 可信网站身份认证35个成功的市场营销策划案例
  • 郑州做网站哪家好网站seo优化分析
  • 网站开发报价 福州太原seo计费管理
  • 重庆秀山网站建设价格营销是什么
  • 网站建设佰金手指科杰十八免费的客户资源怎么找
  • 全国网站开发公司点击进入官方网站
  • 天津专业网站设计报价优秀的营销案例
  • html链接网站模板外包seo公司
  • 网站优化设计方案怎么做网络舆情监测平台
  • 梅州做网站设计公司网页制作app手机版
  • 班级网站开发与设计企业产品推广策划方案