什么叫数组文件? 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://developer.51cto.com/art/200908/142425.htm 一、一维:int[] numbers = new int[]{1,2,3,4,5,6}; //不定长 int[] numbers = new int[3]{1,2,3};//定长 二、多维 int[,] numbers = new int[,]{{1,2,3},{1,2,3}}; //不定长 int[,] numbers = new int[2,2]{{1,2},{1,2}}; //定长 三、例子A:int[] mf1=new int[6]; //注意初始化数组的范围,或者指定初值; //包含6个元素的一维整数数组,初值1,2,3,4,5,6 int[] mf2=new int[6]{1,2,3,4,5,6}; B://一维字符串数组,如果提供了初始值设定项,则还可以省略 new 运算符 string[] mf3={"c","c++","c#"}; C://一维对象数组 Object[] mf4 = new Object[5] { 26, 27, 28, 29, 30 }; D://二维整数数组,初值mf5[0,0]=1,mf5[0,1]=2,mf5[1,0]=3,mf5[1,1]=4 int[,] mf5=new int[,]{{1,2},{3,4}}; E://6*6的二维整型数组 int[,] mf6=new mf[6,6]; 四、取得数组元素个数: int b; b = sizeof (a)/sizeof (*a);C#创建动态数组 using System; using System.Collections; public class SC ...{ static void Main() ...{ ArrayList al=new ArrayList(); al.Add("Hello"); al.Add(" "); al.Add("World"); al.Add("!"); string[] str=new string[al.Count]; al.CopyTo(str,0);//从第0个位置开始复制 for(int i=0;i<str.Length;i++) ...{ Console.WriteLine(i.ToString()+str[i]); } } } 讨论下工作流 求教:局域网访问局域网 窗体显示问题 C# 怎么从文章里取出所有5位以上数字 ??? 这个算法怎么求。。有c#实现 文本存储改作图文混编……求助……急、急、急 求一取值的正则表达式和一个打包的小问题 求B/S体系下Web页面读取RS232串口数据的解决方案(C#) 远程执行C#应用程序出现的问题 怎么将文件上传到数据库中,怎么得到SQL命令的返回值 线程的声明方法 回调函数如何跳出问题
int[] numbers = new int[]{1,2,3,4,5,6}; //不定长
int[] numbers = new int[3]{1,2,3};//定长
二、多维
int[,] numbers = new int[,]{{1,2,3},{1,2,3}}; //不定长
int[,] numbers = new int[2,2]{{1,2},{1,2}}; //定长
三、例子
A:int[] mf1=new int[6];
//注意初始化数组的范围,或者指定初值; //包含6个元素的一维整数数组,初值1,2,3,4,5,6
int[] mf2=new int[6]{1,2,3,4,5,6}; B://一维字符串数组,如果提供了初始值设定项,则还可以省略 new 运算符
string[] mf3={"c","c++","c#"}; C://一维对象数组
Object[] mf4 = new Object[5] { 26, 27, 28, 29, 30 }; D://二维整数数组,初值mf5[0,0]=1,mf5[0,1]=2,mf5[1,0]=3,mf5[1,1]=4
int[,] mf5=new int[,]{{1,2},{3,4}}; E://6*6的二维整型数组
int[,] mf6=new mf[6,6]; 四、取得数组元素个数:
int b;
b = sizeof (a)/sizeof (*a);
C#创建动态数组
using System;
using System.Collections;
public class SC
...{
static void Main()
...{
ArrayList al=new ArrayList();
al.Add("Hello");
al.Add(" ");
al.Add("World");
al.Add("!");
string[] str=new string[al.Count];
al.CopyTo(str,0);//从第0个位置开始复制
for(int i=0;i<str.Length;i++)
...{
Console.WriteLine(i.ToString()+str[i]);
}
}
}