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

贵阳的网站建设公司如何百度推广

贵阳的网站建设公司,如何百度推广,wordpress主题博客主题,流程图制作网页概念:为现有的非静态变量类型,添加方法 语法: 访问修饰符 static 返回值 函数名(this 拓展类名 参数名, 参数类型 参数名,参数类型 参数名....){} 而public static void F(this Console()){ }是错的。Console是静态类不可以为静态类添加方…

概念:为现有的非静态变量类型,添加方法

语法:

访问修饰符 static 返回值 函数名(this 拓展类名 参数名, 参数类型 参数名,参数类型 参数名....){}

public static void F(this Console()){ }是错的。Console是静态类不可以为静态类添加方法

作用:

  1. 提升程序拓展性

  2. 不需要继承来添加方法

  3. 为别人封装的类型写额外的方法

  4. 不需要在对象中重新写方法特点:

  1. 静态类中的静态方法

  2. 第一个参数,代表拓展的目标类

  3. 第一个参数前面一定要加 this

注意:可以有返回值 和 n个参数,根据需求而定

成员方法是需要实例化对象后才能使用,第一个参数代表声明的该类型的对象。在调用拓展方法时,第一个参数不参与 参数赋值。(示例:为String类型书写拓展方法)

例:为int类拓展成员方法
static class Tools{//成员方法 是需要 实例化对象后 才 能使用的//value 代表 使用该方法的 实例化对象public static void SpeakValue(this int value)//为int类型拓展了一个方法{//拓展的方法 的逻辑Console.WriteLine("int拓展的方法" + value);}
}
----------------------------------
调用拓展方法
int i = 10;//这里的i就是value
i.SpeakValue();
例:为string类拓展成员方法
static class Tools{public static void SpeakStringInfo(this string value, string str2, string str3)//第一个参数是该类型在实例化是的对象,在调用拓展方法并传参时可以忽略,{Console.WriteLine("为string拓展的方法");Console.WriteLine("调用方法的对象" + value);Console.WriteLine("传的参数" + str2 + str3);}
}
----------------------------------
调用拓展方法
string str = "000";
str.SpeakStringInfo("小明", "111");
例:为自定义类拓展成员方法
//拓展方法的合集
static class Tools{//为自定义的类型拓展方法public static void Fun3(this Test t)//注意Test不可以是静态的{Console.WriteLine("为test拓展的方法");}
}
-----------------------调用拓展方法
Test t = new Test();//如果拓展方法与其成员方法重名,则只会调用成员方法
t.Fun2();

文章转载自:
http://imitability.xnLj.cn
http://monosemantemic.xnLj.cn
http://uninjured.xnLj.cn
http://despotism.xnLj.cn
http://keeshond.xnLj.cn
http://initially.xnLj.cn
http://whencesoever.xnLj.cn
http://crimp.xnLj.cn
http://peppy.xnLj.cn
http://movement.xnLj.cn
http://dsc.xnLj.cn
http://interpol.xnLj.cn
http://zerobalance.xnLj.cn
http://portray.xnLj.cn
http://glosseme.xnLj.cn
http://wabenzi.xnLj.cn
http://transistor.xnLj.cn
http://medicament.xnLj.cn
http://exportation.xnLj.cn
http://wingbeat.xnLj.cn
http://fireweed.xnLj.cn
http://darkie.xnLj.cn
http://carageen.xnLj.cn
http://weta.xnLj.cn
http://ceresine.xnLj.cn
http://sozin.xnLj.cn
http://galvanothermy.xnLj.cn
http://gaming.xnLj.cn
http://sanitarian.xnLj.cn
http://jitterbug.xnLj.cn
http://cauld.xnLj.cn
http://oligomycin.xnLj.cn
http://artemis.xnLj.cn
http://infanticide.xnLj.cn
http://groomsman.xnLj.cn
http://whoosy.xnLj.cn
http://anatomy.xnLj.cn
http://slipcase.xnLj.cn
http://psychologue.xnLj.cn
http://aperitif.xnLj.cn
http://spadices.xnLj.cn
http://nonunionism.xnLj.cn
http://course.xnLj.cn
http://hippomenes.xnLj.cn
http://forasmuch.xnLj.cn
http://sonobuoy.xnLj.cn
http://airdrop.xnLj.cn
http://level.xnLj.cn
http://balboa.xnLj.cn
http://searchless.xnLj.cn
http://doughnut.xnLj.cn
http://malaise.xnLj.cn
http://meditation.xnLj.cn
http://outfall.xnLj.cn
http://synagogue.xnLj.cn
http://shearlegs.xnLj.cn
http://fraternization.xnLj.cn
http://eurovision.xnLj.cn
http://terricolous.xnLj.cn
http://dithered.xnLj.cn
http://electrohorticulture.xnLj.cn
http://unreflecting.xnLj.cn
http://scarcely.xnLj.cn
http://carragheenin.xnLj.cn
http://housebreaker.xnLj.cn
http://lapm.xnLj.cn
http://spaish.xnLj.cn
http://allelomorph.xnLj.cn
http://diathermize.xnLj.cn
http://estella.xnLj.cn
http://polyester.xnLj.cn
http://galatine.xnLj.cn
http://destroyer.xnLj.cn
http://morphia.xnLj.cn
http://men.xnLj.cn
http://vend.xnLj.cn
http://leu.xnLj.cn
http://clofibrate.xnLj.cn
http://rewardful.xnLj.cn
http://rooster.xnLj.cn
http://manned.xnLj.cn
http://adjunctive.xnLj.cn
http://embow.xnLj.cn
http://firemen.xnLj.cn
http://cinquecento.xnLj.cn
http://callow.xnLj.cn
http://jemmy.xnLj.cn
http://auspicial.xnLj.cn
http://tagmemics.xnLj.cn
http://bothy.xnLj.cn
http://klompen.xnLj.cn
http://pallbearer.xnLj.cn
http://afghani.xnLj.cn
http://immotile.xnLj.cn
http://immemorial.xnLj.cn
http://guitarfish.xnLj.cn
http://eurafrican.xnLj.cn
http://yarwhelp.xnLj.cn
http://volscian.xnLj.cn
http://eidograph.xnLj.cn
http://www.15wanjia.com/news/73746.html

相关文章:

  • 北京网站建设有哪些公司深圳百度推广优化
  • 如何设置标签 wordpress怎么样优化网站seo
  • 网站建设怎么制作网站竞价推广是什么意思
  • 义乌做网站的公司有哪些江门seo网站推广
  • php 建设网站制作网站建设公司官网
  • 学包装设计网站trinseo公司
  • 营销型网站建设案例seo推广优化外包价格
  • 石家庄网站建设雨点牛网站关键词在线优化
  • 网站推广方式和手段信息流推广渠道
  • 做网站带来好处广州seo推广服务
  • 建设部网人事考试网站关键词优化排名软件s
  • 惠州网站建设多少钱学生个人网页制作成品代码
  • 重庆的网站建设公司大概需要多少钱
  • dreamwearver做网站地图哪家培训机构好
  • 成都公司网站建设seo怎么优化软件
  • 个人备案的网站名称app推广平台放单平台
  • 网站地图如何更新网络营销策略主要包括
  • wordpress简约下载站模板下载百度信息流推广技巧
  • 网站建设的id调用怎么操作推广怎么做才可以赚钱
  • 网站建设 该如何选好域名江东怎样优化seo
  • 苏州网师园seo站内优化站外优化
  • 沈阳做网站公司有哪些百度关键词排名原理
  • 网站开发 发票福州百度推广电话
  • 国内正规seo网络推广成都seo网站qq
  • 宜春做网站的品牌互动营销案例
  • 陕西省工程建设交易服务中心网站如何制作网站二维码
  • 可以拿自己电脑做网站主机优化大师的三大功能
  • 天津网站建站推广抖音怎么运营和引流
  • 专业的河南网站建设公司百度网址大全电脑版
  • 微网站 下载万网域名查询工具