数组用于存储一组数据。它由连续的内存位置组成。
一些数组的示例包括 −
在三个已排序的数组中查找公共元素
using System;class Demo { static void commonElements(int []one, int []two, int []three) { int i = 0, j = 0, k = 0; while (i在C#中动态创建数组
using System;using System.Collections;namespace CollectionApplication { class Program { static void Main(string[] args) { ArrayList al = new ArrayList(); al.Add(99); al.Add(47); al.Add(64); Console.WriteLine("Count: {0}", al.Count); Console.Write("List: "); foreach (int i in al) { Console.Write(i + " "); } Console.WriteLine(); Console.ReadKey(); } }}登录后复制
使用C#处理不规则数组并访问元素
using System;namespace ArrayApplication { class MyArray { static void Main(string[] args) { int[][] points = new int[][]{new int[]{10,5},new int[]{30,40}, new int[]{70,80},new int[]{ 60, 70 }};int i, j; for (i = 0; i登录后复制
以上就是C# 中数组的好例子有哪些?的详细内容,更多请关注【创想鸟】其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2431318.html