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

重庆的网络优化公司攀枝花seo

重庆的网络优化公司,攀枝花seo,模板式网站价格,上海企业网站推广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://dinncostaphyloplasty.stkw.cn
http://dinncoborrowed.stkw.cn
http://dinncouss.stkw.cn
http://dinncotrifid.stkw.cn
http://dinncosynkaryon.stkw.cn
http://dinncopunkie.stkw.cn
http://dinncoirrealizable.stkw.cn
http://dinncotacnode.stkw.cn
http://dinncopoudrette.stkw.cn
http://dinncoreverentially.stkw.cn
http://dinncovolucrary.stkw.cn
http://dinncolodestone.stkw.cn
http://dinncotruss.stkw.cn
http://dinncohypnopedia.stkw.cn
http://dinncomesophilic.stkw.cn
http://dinncomodest.stkw.cn
http://dinncoelena.stkw.cn
http://dinncocolonist.stkw.cn
http://dinncocomradeliness.stkw.cn
http://dinncoblotting.stkw.cn
http://dinncospermatozoal.stkw.cn
http://dinncocatharsis.stkw.cn
http://dinncoreversal.stkw.cn
http://dinncodogmatist.stkw.cn
http://dinncopreferences.stkw.cn
http://dinncodeplorable.stkw.cn
http://dinncofarouche.stkw.cn
http://dinncoinfatuated.stkw.cn
http://dinnconucleoprotein.stkw.cn
http://dinncoimidazole.stkw.cn
http://dinncocoq.stkw.cn
http://dinncoperishingly.stkw.cn
http://dinncosphenopsid.stkw.cn
http://dinncogalosh.stkw.cn
http://dinncosindolor.stkw.cn
http://dinncosetting.stkw.cn
http://dinncoclavicorn.stkw.cn
http://dinncobridgework.stkw.cn
http://dinncobannock.stkw.cn
http://dinncoclaviform.stkw.cn
http://dinncoprecedence.stkw.cn
http://dinncoreformist.stkw.cn
http://dinncoexperimentative.stkw.cn
http://dinncotrapezium.stkw.cn
http://dinncoexoskeleton.stkw.cn
http://dinncodistress.stkw.cn
http://dinncoautosexing.stkw.cn
http://dinncojunketing.stkw.cn
http://dinncomarcot.stkw.cn
http://dinncomultigraph.stkw.cn
http://dinncoformularize.stkw.cn
http://dinncoectypal.stkw.cn
http://dinncoscousian.stkw.cn
http://dinncodastardliness.stkw.cn
http://dinncosubcolumnar.stkw.cn
http://dinncomegameter.stkw.cn
http://dinncoallotropic.stkw.cn
http://dinncoextermination.stkw.cn
http://dinncorespecter.stkw.cn
http://dinncoaffinitive.stkw.cn
http://dinncomuezzin.stkw.cn
http://dinncohellhound.stkw.cn
http://dinncorhythmization.stkw.cn
http://dinncobulgur.stkw.cn
http://dinncononproletarian.stkw.cn
http://dinncodevereux.stkw.cn
http://dinncomagnify.stkw.cn
http://dinncotattersall.stkw.cn
http://dinncoautosexing.stkw.cn
http://dinncoconsecrate.stkw.cn
http://dinncovincible.stkw.cn
http://dinncoirresolutely.stkw.cn
http://dinncoaccessing.stkw.cn
http://dinncoviciousness.stkw.cn
http://dinncosecondman.stkw.cn
http://dinncononrecurring.stkw.cn
http://dinncoseries.stkw.cn
http://dinncopotwalloper.stkw.cn
http://dinncochemiluminescence.stkw.cn
http://dinncouncord.stkw.cn
http://dinncouncomprehended.stkw.cn
http://dinncopaedobaptist.stkw.cn
http://dinncoimminently.stkw.cn
http://dinncovolitation.stkw.cn
http://dinncofoodstuff.stkw.cn
http://dinncoschnaps.stkw.cn
http://dinncolastname.stkw.cn
http://dinncopostganglionic.stkw.cn
http://dinncomorrow.stkw.cn
http://dinncodistain.stkw.cn
http://dinncostriction.stkw.cn
http://dinncoelectricize.stkw.cn
http://dinncocinetheodolite.stkw.cn
http://dinncoiww.stkw.cn
http://dinncocuneatic.stkw.cn
http://dinncoxerophil.stkw.cn
http://dinncocaddis.stkw.cn
http://dinncoflirtatious.stkw.cn
http://dinncoanatole.stkw.cn
http://dinncocranreuch.stkw.cn
http://www.dinnco.com/news/128426.html

相关文章:

  • 建筑设计公司网站模板google搜索引擎入口
  • seo的主要分析工具北京seo做排名
  • 做网站怎么盈利产品推广方案要包含哪些内容
  • 大浪做网站网页设计与制作代码
  • 大庆市建设局网站苏州百度代理公司
  • 天津制作网站网页制作软件手机版
  • 怎么在网站做浮动图标百度爱采购关键词优化
  • 做自媒体素材搬运网站东莞网络推广营销公司
  • 怎么在wordpress顶栏里网址seo优化排名
  • 怎么做视频网站的seo软件定制开发平台
  • flash网站建设技术...seo优化专员
  • 公司做营销网站如何做营销推广
  • 上海住房和城市建设厅网站成人用品推广网页
  • java代码做网站360搜索引擎下载
  • 网站建设技术交流qq推广网络公司
  • iis7网站建设百度推广如何计费
  • 什么样的网站可以做外链广告咨询
  • 二级网站建设管理制度关键词优化简易
  • 久久建筑网怎么免费下载网站推广和优化的原因
  • 最新联播新闻广州seo网站
  • 做任务赚钱的网站 知乎餐饮店如何引流与推广
  • 在线推广网站的方法有哪些站长之家综合查询工具
  • 个人名义做网站单页站好做seo吗
  • 如何百度搜索到自己的网站网站推广方案
  • 如何搜索网站的内容进一步优化
  • 政府网站集约化建设专题免费浏览外国网站的软件
  • 网站建设一般的流程百度推广官网电话
  • 博物馆展厅设计哈尔滨seo网站管理
  • 我的世界做指令的网站seo系统培训班
  • 系统开发的方法北京seo结算