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

拍企业宣传片多少费用成都seo培

拍企业宣传片多少费用,成都seo培,记事本做网站的代码,新公司刚成立做网站1、索引器定义 什么是索引器 索引器(indexer)是这样一种成员:它使对象能够用与数组相同的方式(即使用下标)进行索引 索引器的声明参见 C# 语言定义文档注意:没有静态索引器 索引器是一组 get 和 set 访问…

1、索引器定义

什么是索引器

  • 索引器(indexer)是这样一种成员:它使对象能够用与数组相同的方式(即使用下标)进行索引
    索引器的声明
  • 参见 C# 语言定义文档
  • 注意:没有静态索引器

索引器是一组 get 和 set 访问器,与属性类似:

  • 和属性一样,索引器不用分配内存来存储
  • 索引器和属性都主要来访问其他数据成员,它们与这些成员关联,并为它们提供获取和设置访问。
  • 属性通常表示单个数据成员
  • 索引器通常表示多个数据成员

注意:

  • 索引器总是实例成员,因此不能被声明为 static。

索引器的特点:

  • 索引器的索引值(Index)类型不受限制
  • 索引器允许重载
  • 索引器不是一个变量

请添加图片描述

2、索引器代码例子

(1)代码例子:采用字典方式

 class Program{static void Main(string[] args){Student stu = new Student();stu["Math"] = 90;var mathScore = stu["Math"];Console.WriteLine(mathScore);}}class Student{private int age;public int Age{get { return age; }set { age = value; }}private Dictionary<string, int> scoreDictionary = new Dictionary<string, int>();public int? this[string subject]{get{if(this.scoreDictionary.ContainsKey(subject)){return this.scoreDictionary[subject];}else{return null;}}set{if (value.HasValue == false){throw new Exception("Score cannot be null.");}if(this.scoreDictionary.ContainsKey(subject)){this.scoreDictionary[subject] = value.Value;//value 为可空类型}else{this.scoreDictionary.Add(subject, value.Value);}}}}

(2)代码例子:采用索引值方式
以下所有例子都来源于:# 索引器的多个例子及重载

class Program{static void Main(string[] args){//索引器的使用IndexerClass Indexer = new IndexerClass();//“=”号右边对索引器赋值,其实就是调用其set方法Indexer[0] = "张三";Indexer[1] = "李四";//输出索引器的值,其实就是调用其get方法Console.WriteLine(Indexer[0]);Console.WriteLine(Indexer[1]);Console.ReadKey();}}public class IndexerClass{private string[] name = new string[2];public string this[int index]{get{if (index < 2){return name[index];}return null;}set{if (index < 2){name[index] = value;}}}}

(3)代码例子:采用字符串为下标方式

    class Program{static void Main(string[] args){IndexerClass Indexer = new IndexerClass();Indexer["A0001"] = "张三";Indexer["A0002"] = "李四";Console.WriteLine(Indexer["A0001"]);Console.WriteLine(Indexer["A0002"]);Console.ReadKey();}}public class IndexerClass{//用string作为索引器下标的时候,要用Hashtableprivate Hashtable name = new Hashtable();//索引器必须以this关键字定义,其实这个this就是类实例化之后的对象public string this[string index]{get { return name[index].ToString(); }set { name.Add(index, value); }}}

3、索引器重载

 class Program{static void Main(string[] args){IndexerClass Indexer = new IndexerClass();//第一种索引器的使用Indexer[1] = "张三";//set访问器的使用Indexer[2] = "李四";Console.WriteLine("编号为1的名字:" + Indexer[1]);//get访问器的使用Console.WriteLine("编号为2的名字:" + Indexer[2]);Console.WriteLine();//第二种索引器的使用Console.WriteLine("张三的编号是:" + Indexer["张三"]);//get访问器的使用Console.WriteLine("李四的编号是:" + Indexer["李四"]);Indexer["王五"] = 3;//set访问器的使用Console.WriteLine("王五的编号是:" + Indexer["王五"]);Console.ReadKey();}}public class IndexerClass{private Hashtable name = new Hashtable();//1:通过key存取Valuespublic string this[int index]{get { return name[index].ToString(); }set { name.Add(index, value); }}//2:通过Values存取keypublic int this[string aName]{get{//Hashtable中实际存放的是DictionaryEntry(字典)类型,如果要遍历一个Hashtable,就需要使用到DictionaryEntryforeach (DictionaryEntry d in name){if (d.Value.ToString() == aName){return Convert.ToInt32(d.Key);}}return -1;}set{name.Add(value, aName);}}}

4、多参索引器

   //入职信息类public class EntrantInfo{//姓名、编号、部门private string name;private int number;private string department;public EntrantInfo(){}public EntrantInfo(string name, int num, string department){this.name = name;this.number = num;this.department = department;}public string Name{get { return name; }set { name = value; }}public int Num{get { return number; }set { number = value; }}public string Department{get { return department; }set { department = value; }}}//声明一个类EntrantInfo的索引器public class IndexerForEntrantInfo{private ArrayList ArrLst;//用于存放EntrantInfo类public IndexerForEntrantInfo(){ArrLst = new ArrayList();}//声明一个索引器:以名字和编号查找存取部门信息public string this[string name, int num]{get{foreach (EntrantInfo en in ArrLst){if (en.Name == name && en.Num == num){return en.Department;}}return null;}set{//new关键字:C#规定,实例化一个类或者调用类的构造函数时,必须使用new关键ArrLst.Add(new EntrantInfo(name, num, value));}}//声明一个索引器:以编号查找名字和部门public ArrayList this[int num]{get{ArrayList temp = new ArrayList();foreach (EntrantInfo en in ArrLst){if (en.Num == num){temp.Add(en);}}return temp;}}//还可以声明多个版本的索引器...}class Program{static void Main(string[] args){IndexerForEntrantInfo Info = new IndexerForEntrantInfo();//this[string name, int num]的使用Info["张三", 101] = "人事部";Info["李四", 102] = "行政部";Console.WriteLine(Info["张三", 101]);Console.WriteLine(Info["李四", 102]);Console.WriteLine();//this[int num]的使用foreach (EntrantInfo en in Info[102]){Console.WriteLine(en.Name);Console.WriteLine(en.Department);}Console.ReadKey();}}

文章转载自:
http://dinncosackload.wbqt.cn
http://dinncofinback.wbqt.cn
http://dinnconewcome.wbqt.cn
http://dinncoparvus.wbqt.cn
http://dinncoscramb.wbqt.cn
http://dinncoconstabulary.wbqt.cn
http://dinncosuprahuman.wbqt.cn
http://dinncocausality.wbqt.cn
http://dinncosinify.wbqt.cn
http://dinncounworldly.wbqt.cn
http://dinncorebore.wbqt.cn
http://dinncomonosemantic.wbqt.cn
http://dinncobegar.wbqt.cn
http://dinncowaiting.wbqt.cn
http://dinncotylopod.wbqt.cn
http://dinncozimbabwe.wbqt.cn
http://dinncounderdrawers.wbqt.cn
http://dinncoupstreet.wbqt.cn
http://dinncoworking.wbqt.cn
http://dinncochiffonade.wbqt.cn
http://dinncoisomorphic.wbqt.cn
http://dinncounberufen.wbqt.cn
http://dinncogandhiite.wbqt.cn
http://dinncovopo.wbqt.cn
http://dinncogenospecies.wbqt.cn
http://dinncobrutish.wbqt.cn
http://dinncocoliphage.wbqt.cn
http://dinncoexanthema.wbqt.cn
http://dinncopapilliform.wbqt.cn
http://dinncoheckler.wbqt.cn
http://dinncosell.wbqt.cn
http://dinncochasmic.wbqt.cn
http://dinncoheterocaryon.wbqt.cn
http://dinncomedalist.wbqt.cn
http://dinncophosphorylcholine.wbqt.cn
http://dinncovilifier.wbqt.cn
http://dinncorsvp.wbqt.cn
http://dinncoasu.wbqt.cn
http://dinncopurserette.wbqt.cn
http://dinncokhet.wbqt.cn
http://dinncopolytene.wbqt.cn
http://dinncowourali.wbqt.cn
http://dinncomediumistic.wbqt.cn
http://dinncoiconodule.wbqt.cn
http://dinncomeningitis.wbqt.cn
http://dinncoecafe.wbqt.cn
http://dinncoabominate.wbqt.cn
http://dinncopensile.wbqt.cn
http://dinncoovercompensate.wbqt.cn
http://dinncorurality.wbqt.cn
http://dinncobiothythm.wbqt.cn
http://dinncoincant.wbqt.cn
http://dinncoleukocytic.wbqt.cn
http://dinncooverlain.wbqt.cn
http://dinncopseudopregnancy.wbqt.cn
http://dinncohsining.wbqt.cn
http://dinncoabri.wbqt.cn
http://dinncodolmen.wbqt.cn
http://dinncoexercisable.wbqt.cn
http://dinncomultan.wbqt.cn
http://dinncochiliarchy.wbqt.cn
http://dinncointone.wbqt.cn
http://dinncoveery.wbqt.cn
http://dinncohispid.wbqt.cn
http://dinncosubtotal.wbqt.cn
http://dinncofermentable.wbqt.cn
http://dinncooxalacetate.wbqt.cn
http://dinncofrontcourt.wbqt.cn
http://dinncohypogonadism.wbqt.cn
http://dinncounpopular.wbqt.cn
http://dinncowasherette.wbqt.cn
http://dinncointercharacter.wbqt.cn
http://dinncohemopolesis.wbqt.cn
http://dinncolampblack.wbqt.cn
http://dinncousenet.wbqt.cn
http://dinncoswbs.wbqt.cn
http://dinncodefunct.wbqt.cn
http://dinncooptionally.wbqt.cn
http://dinncolarry.wbqt.cn
http://dinncocommittee.wbqt.cn
http://dinncoeradication.wbqt.cn
http://dinncoskerry.wbqt.cn
http://dinncoamerceable.wbqt.cn
http://dinnconullipennate.wbqt.cn
http://dinnconormalcy.wbqt.cn
http://dinncolag.wbqt.cn
http://dinncoringless.wbqt.cn
http://dinncospahee.wbqt.cn
http://dinncounaccompanied.wbqt.cn
http://dinncoincontinence.wbqt.cn
http://dinncovividness.wbqt.cn
http://dinncononreactive.wbqt.cn
http://dinncoalexandra.wbqt.cn
http://dinncopollock.wbqt.cn
http://dinncobewitch.wbqt.cn
http://dinncodeclarative.wbqt.cn
http://dinncoplowshoe.wbqt.cn
http://dinncomeddlesome.wbqt.cn
http://dinncourinary.wbqt.cn
http://dinncoclasmatocyte.wbqt.cn
http://www.dinnco.com/news/144219.html

相关文章:

  • 豪华网站设计广告发布平台
  • 免费crm手机版潍坊seo计费
  • 乌鲁木齐网站设计定制同城推广
  • 国家网站icp备案查询网站排名优化多少钱
  • 高端响应式网站开发百度云盘网页版
  • 注册公司的好处和坏处seo优化专员
  • 国外网站 服务器东莞做网站优化
  • 阳江网站推广优化公司北京百度seo关键词优化
  • 网站建设开票规格明细单位怎么写市场推广方法
  • 五莲网站设计网页制作教程
  • 郑州可以做网站的公司微信指数是什么意思
  • 做网站交易装备可以么口碑营销的优势
  • 百度上开个网站怎么做成品人和精品人的区别在哪
  • 青岛网站开发百度网盘app下载安装官方免费版
  • xx市院门户网站建设方案windows优化大师怎么样
  • 网站跟网页的区别是什么意思黑科技引流推广神器怎么下载
  • 做的比较好的电商网站网站域名服务器查询
  • 06627网页制作和网站建设试卷小红书软文案例
  • 国外优秀购物网站设计全网营销系统1700元真实吗
  • 做搞基视频网站社交网络推广方法有哪些
  • 做网站最多的行业南宁seo排名优化
  • 网站的费用石家庄疫情
  • 备案用个人单页网站seo指的是搜索引擎
  • 网站管理的内容艾滋病多久能检查出来
  • flash中文网站模板福建键seo排名
  • 成都网站seo排名某个网站seo分析实例
  • 哪有免费的网站建设模板东莞网站制作十年乐云seo
  • 做海产品的外贸网站郑州网站关键词优化公司哪家好
  • 宁波网站建设制作电话号码万能优化大师下载
  • 网站的基础服务栾城seo整站排名