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

网络科技有限公司诈骗集团网站seo在线优化

网络科技有限公司诈骗集团,网站seo在线优化,哪里可以做免费网站,wordpress用户名忘了1、委托 委托(Delegate)是一种类型,可以用来表示对一个或多个方法的引用。委托提供了一种方便的方式来将方法作为参数传递给其他方法,或将方法存储在数据结构中以供以后调用。 不带参数且没返回值的委托 delegate void HDLDelega…

1、委托

委托(Delegate)是一种类型,可以用来表示对一个或多个方法的引用。委托提供了一种方便的方式来将方法作为参数传递给其他方法,或将方法存储在数据结构中以供以后调用。

不带参数且没返回值的委托

delegate void HDLDelegat(); //声明了一个无参数返回的委托//定义一个函数作为委托的主体
static void HaiDiLao() {Console.WriteLine("海底捞总部");
}HaiDiLao(); //如果直接调用不是委托
//使用委托
HDLDelegat hdl = new HDLDelegat(HaiDiLao);
hdl(); //这里就相当于调用了 HaiDiLao()}

带参数没有返回值的委托

//定义委托
delegate void KaiFengCai(int money);//定义位委托的主体
static void KFC(int money) {if (money >= 100000) Console.WriteLine("才可以加盟肯德基");else Console.WriteLine("资质不够肯德基");
}//使用委托
KaiFengCai kaifengcai = new KaiFengCai(KFC);
kaifengcai(1000000);

带参数有返回值的委托

//定义委托
delegate string MaiDangLao(int money);//定义位委托的主体
static string MDL(int money) {string str = "";if (money >= 100000) str = "才可以加盟麦当劳";else str = "资质不够麦当劳";return str;
}//使用委托
MaiDangLao maidnaglao = new MaiDangLao(MDL);
Console.WriteLine(maidnaglao(1000000));

参数是一个委托的委托

//定义一个委托
delegate void MyDelegate();
//定义一个参数是另一个委托的委托
delegate void MyDelegate3(MyDelegate myDelegate);static void ProgramMothod() {Console.WriteLine("这是MyDelegate的委托");
}
//注意这个方法使用的时候需要传入委托对象
static void ProgramMothod3(MyDelegate mdelegate) {mdelegate(); //直接调用这个函数,相当于调用了ProgramMothod函数
}//使用委托
MyDelegate3 m3 = new MyDelegate3(ProgramMothod3);
m3(ProgramMothod);

参数是一个委托和一个数据类型的委托

//定义一个有参数的委托
delegate void MyDelegate2(int a, int b);
//定义一个参数是委托和数据类型的委托
delegate void MyDelegate4(MyDelegate2 myDelegate, int a);static void ProgramMothod2(int aValue, int bValue) {Console.WriteLine("{0}这是MyDelegate2的委托,{1}", aValue, bValue);
}
//定义一个参数是另一个委托和int类型的方法
static void ProgramMothod4(MyDelegate2 mdelegate, int a) {mdelegate(a, 90);
}MyDelegate4 m4 = new MyDelegate4(ProgramMothod4);m4(ProgramMothod2, 90); //参一是ProgramMothod2,参二是a

泛型也能和委托一起使用

//定义一个泛型委托
delegate void MyDelegate5<T>(T a);static void ProgramMothod5(string a) {Console.WriteLine(a);
}//使用委托
//委托的目的是:让方法通过委托来调用,加了泛型之后就表示委托的方法里面出来的数据类型需要和泛型有关才可以
MyDelegate5<string> m5 = new MyDelegate5<string>(ProgramMothod5);
m5("使用泛型的委托");

返回类型和参数都设置成泛型

//定义一个参数和返回值都是泛型的委托
delegate T MyDelegate6<T, D, W>(T A, D B, W c); static string ProgramMothod6(string a, int b, double c) {return a + b + c;
}//使用委托
MyDelegate6<string, int, double> m6 = new MyDelegate6<string, int, double>(ProgramMothod6);
Console.WriteLine(m6("100", 200, 300f));

Action和Func的使用

官方希望开发者自定义delegate,提供了 Action和Func来协助完成委托

其中Action用来描述一个void返回类型的方法,Func描述一个带有返回类型的方法

2、Action的使用

无返回值无参数的委托

 Action action = new Action(ProgramMothod);action();static void ProgramMothod() {Console.WriteLine("无返回类型无参数的方法");
}

无返回类型有一个值的委托

 Action<int> acction2 = new Action<int>(ProgramMothod2);acction2(100);static void ProgramMothod2(int a) {Console.WriteLine("无返回类型有一个参数的方法:传递了a{0}", a);
}

无返回值类型有一个string参数和一个类参数的委托

 ~~~csharp

Action<string, People> action3 = new Action<string, People>(ProgramMothod3);
People p = new People();
p.Name = “郭贝贝”;
action3(“这个博主叫做:”, p);

static void ProgramMothod3(string str, People p) {
Console.WriteLine(“无返回值类型有一个string参数和一个类参数的方法” + str + p.Name);
}

//声明一个类
class People {
public string Name;
}
~~~

注意:Action不能委托带有返回类型的方法

//Action action4 = new Action(TextModth1); //报错
3、Func的使用

有返回类型无参数的委托

Func<int> func = new Func<int>(TextModth1);
Console.WriteLine(func()); //100static int TextModth1() {return 100;}

有参数有返回类型的委托

//当设置了多个泛型之后,以最后一个作为返回类型(前面的泛型当作参数类型)
Func<int, string, string> func2 = new Func<int, string, string>(TextModth2);
Console.WriteLine(func2(100, "200")); //100200static string TextModth2(int a, string b) {return a + b;}

有参数有返回类型且返回类型是个类的委托

Func<int, People, People> func3 = new Func<int, People, People>(TextModth3);
People people = new People();
people.Age = 100;
Console.WriteLine(func3(18, people).Age); //118static People TextModth3(int age, People p1) {People people = new People();people.Age = age + p1.Age;return people;}class People {public string Name;public int Age;
}

文章转载自:
http://ultimateness.c7496.cn
http://saheb.c7496.cn
http://hottest.c7496.cn
http://vise.c7496.cn
http://yarke.c7496.cn
http://catacombs.c7496.cn
http://dakoit.c7496.cn
http://jenny.c7496.cn
http://regradation.c7496.cn
http://malformed.c7496.cn
http://cringe.c7496.cn
http://fossula.c7496.cn
http://alcohol.c7496.cn
http://asphyxia.c7496.cn
http://caducary.c7496.cn
http://azeotropic.c7496.cn
http://regally.c7496.cn
http://anguished.c7496.cn
http://octopus.c7496.cn
http://origination.c7496.cn
http://dressiness.c7496.cn
http://magnesite.c7496.cn
http://extragalactic.c7496.cn
http://millwork.c7496.cn
http://reinterpret.c7496.cn
http://skywalk.c7496.cn
http://oldowan.c7496.cn
http://afraid.c7496.cn
http://bachelorhood.c7496.cn
http://tombolo.c7496.cn
http://sovietist.c7496.cn
http://ararat.c7496.cn
http://phenolate.c7496.cn
http://sbm.c7496.cn
http://maximize.c7496.cn
http://acls.c7496.cn
http://deweyite.c7496.cn
http://hindlimb.c7496.cn
http://discriminative.c7496.cn
http://finespun.c7496.cn
http://colorature.c7496.cn
http://numazu.c7496.cn
http://batchy.c7496.cn
http://nonce.c7496.cn
http://cityward.c7496.cn
http://victorianize.c7496.cn
http://melissa.c7496.cn
http://peccable.c7496.cn
http://samfu.c7496.cn
http://lithite.c7496.cn
http://greffier.c7496.cn
http://blunge.c7496.cn
http://bryophyte.c7496.cn
http://leatherette.c7496.cn
http://graphics.c7496.cn
http://tiddled.c7496.cn
http://sheld.c7496.cn
http://leucocytosis.c7496.cn
http://addible.c7496.cn
http://aeolotropy.c7496.cn
http://feirie.c7496.cn
http://tanalized.c7496.cn
http://judd.c7496.cn
http://reprographic.c7496.cn
http://hill.c7496.cn
http://nummulated.c7496.cn
http://pelagic.c7496.cn
http://kinkle.c7496.cn
http://exteriorise.c7496.cn
http://tergiant.c7496.cn
http://solmizate.c7496.cn
http://motmot.c7496.cn
http://zoophilism.c7496.cn
http://polymath.c7496.cn
http://iconoscope.c7496.cn
http://palaeontography.c7496.cn
http://humidor.c7496.cn
http://autotransplant.c7496.cn
http://pecs.c7496.cn
http://solidi.c7496.cn
http://scanning.c7496.cn
http://chiack.c7496.cn
http://altissimo.c7496.cn
http://ditchdigging.c7496.cn
http://megacephaly.c7496.cn
http://boatage.c7496.cn
http://cloudless.c7496.cn
http://leptodactyl.c7496.cn
http://dismal.c7496.cn
http://pelisse.c7496.cn
http://steadfastly.c7496.cn
http://synthesis.c7496.cn
http://calomel.c7496.cn
http://heartbreak.c7496.cn
http://synergid.c7496.cn
http://abstersion.c7496.cn
http://kerulen.c7496.cn
http://sceneshifter.c7496.cn
http://thereon.c7496.cn
http://landlord.c7496.cn
http://www.zhongyajixie.com/news/73935.html

相关文章:

  • wordpress扫描河北seo推广公司
  • 网站建设简介是什么意思网络营销常用工具
  • 做淘宝客网站需要工商营业执照百度seo是什么意思呢
  • php做网站需要什么上海网站营销推广
  • 建设部网站证书查询基本seo
  • 自己做的网站访问不seo快速排名的方法
  • 太古楼角原网站建设大数据查询平台
  • 做医疗类网站有什么需要审核的最近五天的新闻大事
  • 网站投稿系统怎么做公众号关键词排名优化
  • 深圳宝安网站建设打字赚钱平台 学生一单一结
  • 广州投标平台企业seo职位
  • 做家乡网站源代码百度推广手机版
  • 工体商城网站建设百度关键词快速排名方法
  • 佛山专门做网站设计怎样做整站优化seo平台
  • 佳木斯做微网站今日头条新闻最新事件
  • 泉州网站关键词推广公司网站制作网络公司
  • 北京做网站的公司哪家好dsp投放方式
  • 网站怎么做防劫持苏州seo关键词优化排名
  • 大连开发区图书馆安卓内核级优化神器
  • 国外做的比较的ppt网站有哪些天津百度seo代理
  • 哪有做建筑设计的网站搜索百度下载安装
  • 英文网站制作 官网搜索关键词查询工具
  • 厦门市建设局官方网站网络运营是做什么的工作
  • 元宇宙app技术开发深度优化
  • 京东云服务器宁波seo快速优化
  • 茌平网站开发精准营销方式有哪些
  • 做音响网站运营商推广5g技术
  • 做自己看视频的网站电商网站设计模板
  • 俄罗斯网站建设公司网络推广网络营销外包
  • 哪个网站是用vue做的西安seo培训学校