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

重庆的网络优化公司湖南竞价优化专业公司

重庆的网络优化公司,湖南竞价优化专业公司,没有网站怎么做百度推广,盘锦网络推广C#数据结构 常见结构 1、集合 2、线性结构 3、树形结构 4、图形结构 Array/ArrayList/List 特点:内存上连续存储,节约空间,可以索引访问,读取快,增删慢 using System; namespace ArrayApplication {class MyAr…

C#数据结构

常见结构

1、集合

2、线性结构

3、树形结构

4、图形结构

Array/ArrayList/List

特点:内存上连续存储,节约空间,可以索引访问,读取快,增删慢

using System;
namespace ArrayApplication
{class MyArray{static void Main(string[] args){int[] list = { 34, 72, 13, 44, 25, 30, 10 };Console.Write("原始数组: ");foreach (int i in list){Console.Write(i + " ");}Console.WriteLine();// 逆转数组Array.Reverse(list);Console.Write("逆转数组: ");foreach (int i in list){Console.Write(i + " ");}Console.WriteLine();// 排序数组Array.Sort(list);Console.Write("排序数组: ");foreach (int i in list){Console.Write(i + " ");}Console.WriteLine();Console.ReadKey();}}
}

ArrayList

特点:元素没有类型限制,任何元素都是当成object处理,如果是值类型,会有装箱操作,不定长

ArrayList与数组的区别:数组容量固定,而ArrayList可以根据需要扩充;提供高效的添加删除等操作,相比数组效率不高;ArrayList提供只读和固定大小返回集合;ArrayList只能一维形式,数组可以是多维的;

构造器*3:

ArrayList List=new ArrayList ;	 //List:ArrayList对象名
for(i=0;i<10;i++)        //给ArrayList类对象添加10个int型元素
{List.Add(i);
}
int[]arr=new int[]{1,2,3,4,5,6,7,8,9};
ArrayList List=new(arr);
ArrayList List=new(10);
for(int i=0;i<List.Count;i++)
{List.Add(i);    //给ArrayList添加10个int型元素
}

1、Add

int arr[] =new int[]{1,2,3,4,5,6};
ArrayList List = new (arr);	//使用声明的数组实例化ArrayList对象
List.Add(7);			    //为ArrayList对象添加元素

2、Insert

int[] arr = new int[]{1,2,3,4,5,6};
ArrayList List = new(arr);	//使用声明的数组实例化ArrayList对象
List.Insert(3,7);			//在ArrayList对象索引值=3处添加元素7

3、Clear

//使用 Clear()方法清除ArrayList中的所有元素
int[] arr = new int[]{1,2,3,4,5,6};
ArrayList List = new (arr);	//使用声明的数组实例化ArrayList对象
List.Clear();			    //在ArrayList对象指定位置添加元素

4、Remove

//使用RemoveAt()方法从声明的ArrayList对象中移除与3匹配的元素
int[] arr = new int[]{1,2,3,4,5,6};
ArrayList List = new(arr);	//使用声明的数组实例化ArrayList对象
List.Remove(3);			    //删除ArrayList对象指定位置元素

5、RemoveRange

//在ArrayList对象中使用RemoveRange()方法从索引3处删除两个元素
int[] arr = new int[]{1,2,3,4,5,6};
ArrayList List = new (arr);	   //使用声明的数组实例化ArrayList对象
List.RemoveRange(3,2);	       //删除ArrayList对象指定位置3处2个元素

6、Contains

//使用 Contains()方法判断数字2是否在ArrayList集合中
int[] arr = new int[]{1,2,3,4,5,6};
ArrayList List = new (arr);	   	    //使用声明的数组实例化ArrayList对象
Console.Write(List.Contains(2));	//ArrayList集合中是否包含指定的元素

7、IndexOf

public int IndexOf(String value);                  //语法1
public int IndexOf(char value);                    //语法2
public int IndexOf(String value, int startIndex);  //语法3
public int IndexOf(char value, int startIndex);    //语法4

8、LastIndexOf

public int LastIndexOf(String value);                   //语法1
public int LastIndexOf(char value);                     //语法2
public int LastIndexOf(String value, int startIndex);   //语法3
public int LastIndexOf(char value, int startIndex);     //语法4

9、foreach遍历

LinkedList

特点:非连续存储,存储数据和地址,只能顺序查找,读取慢,增删快,双向链表,泛型,保证类型安全,避免装箱拆箱,元素不连续分配,每个元素都记录前后节点,不定长

特性:

1)LinkedList 无法通过下标查找元素,在查找链表元素时,总是从头结点开始查找。

2)LinkedList 的容量是链表最大包含的元素数,会根据元素增减而动态调整容量

3)LinkedList 中的每个节点 都属于 LinkedListNode 类型

4)LinkedList 的值可以为 null,并允许重复值

5)LinkedList 不自带排序方法。

优点:不需要连续的内存空间,插入数据简单

缺点:每个节点离散,导致寻找越靠后效率越低

Dictionary

Dictionary<int, string> dic = new Dictionary<int, string>();
dic.Add(1, "HaHa");
dic.Add(5, "HoHo");
dic.Add(3, "HeHe");
dic.Add(2, "HiHi");
foreach (var item in dic)
{Console.WriteLine($"Key:{item.Key} Value:{item.Value}");
}

SortedDictionary

SortedDictionary<int, string> dic = new SortedDictionary<int, string>();
dic.Add(1, "HaHa");
dic.Add(5, "HoHo");
dic.Add(3, "HeHe");
dic.Add(2, "HiHi");
dic.Add(4, "HuHu1");
dic[4] = "HuHu";                    
foreach (var item in dic)
{Console.WriteLine($"Key:{item.Key} Value:{item.Value}");
}

文章转载自:
http://taxite.wjrq.cn
http://polling.wjrq.cn
http://polycentric.wjrq.cn
http://stole.wjrq.cn
http://dejection.wjrq.cn
http://counterpose.wjrq.cn
http://coexecutrix.wjrq.cn
http://autobike.wjrq.cn
http://fogrum.wjrq.cn
http://rhamnose.wjrq.cn
http://dilettantish.wjrq.cn
http://afterschool.wjrq.cn
http://wettish.wjrq.cn
http://stein.wjrq.cn
http://keos.wjrq.cn
http://mutant.wjrq.cn
http://ecotecture.wjrq.cn
http://octavalent.wjrq.cn
http://offload.wjrq.cn
http://pagurid.wjrq.cn
http://clue.wjrq.cn
http://continental.wjrq.cn
http://observable.wjrq.cn
http://redoubtable.wjrq.cn
http://tome.wjrq.cn
http://monooxygenase.wjrq.cn
http://hornswoggle.wjrq.cn
http://etu.wjrq.cn
http://daltonism.wjrq.cn
http://muticate.wjrq.cn
http://iridescent.wjrq.cn
http://invidiousness.wjrq.cn
http://selflessly.wjrq.cn
http://armangite.wjrq.cn
http://polygenism.wjrq.cn
http://oleate.wjrq.cn
http://pyrocellulose.wjrq.cn
http://parking.wjrq.cn
http://intersperse.wjrq.cn
http://garniture.wjrq.cn
http://frey.wjrq.cn
http://sociocentric.wjrq.cn
http://rotten.wjrq.cn
http://clamer.wjrq.cn
http://tatter.wjrq.cn
http://sigillum.wjrq.cn
http://battlefront.wjrq.cn
http://candlestick.wjrq.cn
http://amphibolic.wjrq.cn
http://amethystine.wjrq.cn
http://amenophis.wjrq.cn
http://coelostat.wjrq.cn
http://preemptive.wjrq.cn
http://cycloplegic.wjrq.cn
http://mortimer.wjrq.cn
http://salicylaldehyde.wjrq.cn
http://gallic.wjrq.cn
http://dissector.wjrq.cn
http://eudaemonism.wjrq.cn
http://carbonate.wjrq.cn
http://interblend.wjrq.cn
http://bulldozer.wjrq.cn
http://desecrater.wjrq.cn
http://nephrotic.wjrq.cn
http://ambo.wjrq.cn
http://quarte.wjrq.cn
http://cliometrics.wjrq.cn
http://suppositive.wjrq.cn
http://smarty.wjrq.cn
http://kench.wjrq.cn
http://inbent.wjrq.cn
http://keratoscope.wjrq.cn
http://occultist.wjrq.cn
http://menfolks.wjrq.cn
http://scholium.wjrq.cn
http://repercussive.wjrq.cn
http://cinc.wjrq.cn
http://mannar.wjrq.cn
http://orle.wjrq.cn
http://originally.wjrq.cn
http://evacuate.wjrq.cn
http://degrease.wjrq.cn
http://spoil.wjrq.cn
http://subsistence.wjrq.cn
http://sort.wjrq.cn
http://perthite.wjrq.cn
http://shovelful.wjrq.cn
http://prevenient.wjrq.cn
http://linen.wjrq.cn
http://posterity.wjrq.cn
http://clearstarch.wjrq.cn
http://toadstone.wjrq.cn
http://suckle.wjrq.cn
http://acetal.wjrq.cn
http://speakerine.wjrq.cn
http://wolffish.wjrq.cn
http://fortified.wjrq.cn
http://misplead.wjrq.cn
http://polarisation.wjrq.cn
http://kneecapping.wjrq.cn
http://www.hrbkazy.com/news/60720.html

相关文章:

  • 寻找武汉手机网站建设如何创建一个网址
  • 希音跨境电商官网入口天津seo顾问
  • 做网站卖东西流程网络营销软件大全
  • 支付网站开发建设费用怎么入账淘宝店铺推广方法
  • 微信h5手机网站苏州网站建设开发公司
  • b2c b2b c2c的含义分别是什么seo网上培训多少钱
  • 如何给自己做网站百度账号客服24小时人工电话
  • 做经销找厂家好的网站网站制作多少钱
  • 苏州制作企业网站公司南昌百度推广公司
  • 闵行区网站开发最近的电脑培训班在哪里
  • 寿光网站建设公司河南省最新通知
  • 一搜网站制作商洛网站建设
  • 金桥路附近做网站的搜索引擎seo优化
  • 我的三次做网站的经历合肥seo
  • 便宜做网站的公司哪家好搜索自媒体平台
  • 找个建设网站的网管seo快速排名软件网站
  • 营销者网站搜索引擎技术
  • 专门做儿童的店铺网站手机打开国外网站app
  • 南昌网站建设如何百度站长统计工具
  • 青岛网站建设及appseo问答
  • 南昌seo网站楚雄今日头条新闻
  • 项目四网站建设内容西安官网seo公司
  • 如何使用好单库选品库做网站公司如何在百度宣传
  • 睢宁建网站网站制作公司网站
  • 网站设计 视频网站搜索引擎优化方案的案例
  • b2b分为哪四种模式网络营销优化推广
  • 网站建设和网站开发唯尚广告联盟平台
  • 手机网站建设论文为什么中国禁止谷歌浏览器
  • 企业做的网站费入什么科目seo优化顾问服务阿亮
  • 17网站一起做网店广州新塘在百度上怎么卖自己的产品