
数组用于存储一组数据。它由连续的内存位置组成。
一些数组的示例包括 −
修正了V1.10的一些BUG感购物HTML系统是集合目前网络所有购物系统为参考而开发,代码采用DIV编号,不管从速度还是安全我们都努力做到最好,此版虽为免费版但是功能齐全,无任何错误,特点有:专业的、全面的电子商务解决方案,使您可以轻松实现网上销售;自助式开放性的数据平台,为您提供充满个性化的设计空间;功能全面、操作简单的远程管理系统,让您在家中也可实现正常销售管理;严谨实用的全新商品数据库,便于
0
using System;
class Demo {
static void commonElements(int []one, int []two, int []three) {
int i = 0, j = 0, k = 0;
while (i < one.Length && j < two.Length && k < three.Length) {
if (one[i] == two[j] && two[j] == three[k]) {
Console.Write(one[i] + " ");
i++;j++;k++;
}
else if (one[i] < two[j])
i++;
else if (two[j] < three[k])
j++;
else
k++;
}
}
public static void Main() {
int []one = {20, 35, 57, 70};
int []two = {9, 35, 57, 70, 92};
int []three = {25, 35, 55, 57, 67, 70};
Console.Write("Common elements: ");
commonElements(one, two, three);
}
}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();
}
}
}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 < 3; i++) {
for (j = 0; j < 2; j++) {
Console.WriteLine("a[{0}][{1}] = {2}", i, j, points[i][j]);
}
}
// access
int x = points[0][1];
Console.WriteLine(x);
Console.ReadKey();
}
}
}以上就是C# 中数组的好例子有哪些?的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号