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

怎么维护好网站手机网页 模板

怎么维护好网站,手机网页 模板,网络营销策划包括哪些内容,第三方平台网站的建设规划1、委托 委托#xff08;Delegate#xff09;是一种类型#xff0c;可以用来表示对一个或多个方法的引用。委托提供了一种方便的方式来将方法作为参数传递给其他方法#xff0c;或将方法存储在数据结构中以供以后调用。 不带参数且没返回值的委托 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 MyDelegate5T(T a);static void ProgramMothod5(string a) {Console.WriteLine(a); }//使用委托 //委托的目的是让方法通过委托来调用加了泛型之后就表示委托的方法里面出来的数据类型需要和泛型有关才可以 MyDelegate5string m5 new MyDelegate5string(ProgramMothod5); m5(使用泛型的委托);返回类型和参数都设置成泛型 //定义一个参数和返回值都是泛型的委托 delegate T MyDelegate6T, D, W(T A, D B, W c); static string ProgramMothod6(string a, int b, double c) {return a b c; }//使用委托 MyDelegate6string, int, double m6 new MyDelegate6string, 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(无返回类型无参数的方法); }无返回类型有一个值的委托 Actionint acction2 new Actionint(ProgramMothod2);acction2(100);static void ProgramMothod2(int a) {Console.WriteLine(无返回类型有一个参数的方法传递了a{0}, a); }无返回值类型有一个string参数和一个类参数的委托 Actionstring, People action3 new Actionstring, 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的使用 有返回类型无参数的委托 Funcint func new Funcint(TextModth1); Console.WriteLine(func()); //100static int TextModth1() {return 100;}有参数有返回类型的委托 //当设置了多个泛型之后以最后一个作为返回类型前面的泛型当作参数类型 Funcint, string, string func2 new Funcint, string, string(TextModth2); Console.WriteLine(func2(100, 200)); //100200static string TextModth2(int a, string b) {return a b;}有参数有返回类型且返回类型是个类的委托 Funcint, People, People func3 new Funcint, 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://www.pierceye.com/news/352065/

相关文章:

  • 溧阳网站建设哪家好网站建设的教程
  • 360怎么做网站做pop网站
  • 网站建设方案书2000字中国正国级名单
  • 企业网站的布局类型网站移动页面怎么做的
  • 人是用什么做的视频网站吗wordpress如何设水印图片
  • 蛋糕店的网站建设咋写深圳市宝安区邮政编码
  • 东莞横沥网站建设杭州网站制作排名
  • 百合怎么做网站网站开发语
  • 网站搭建哪里找最好天津市建设工程信息网站
  • 有免费注册网站吗做教育网站还挣钱吗
  • 网站做百度推广需要哪些条件店铺推广软文范例
  • 台州企业网站搭建特点迅美网站建设
  • 做营销网站推广官方网站建设方法
  • 网页设计精选网站网站查询功能怎么做
  • 重庆专业网站推广流程建立平台的步骤
  • 舟山市普陀区建设局网站net网站开发 兼职
  • 网站备案流程阿里云南宁网站建设官网
  • h5网站制作介绍简单的静态 新闻 asp 网站源码
  • 济南seo网站推广公司帮别人做彩票网站吗
  • 郑州市网站建设怎么样wordpress wp editor
  • 台州网站建设 推广公司网络营销课程总结范文
  • 网站 外包 版权杭州做官网的有哪些公司
  • 微信网站html5中山平面设计公司
  • 建站网站教程视频世界网站排名
  • 做小程序的流程seo 整站优化
  • 网站前台代码国内网站主机
  • 网站后台asp源码高明顺德网站建设
  • 网站建设推广软文网络规划设计师考试全程指导(第2版) pdf
  • 备案网站多少钱支持wordpress的空间
  • 哈尔滨网页模板建站wordpress网页设定