using System;
public struct tableStruct
{
public string tableName; public string[] colDef;
}
因为colDef的长度不确定,需要动态指定.如何实现?
public string[] colDef;
int i = 10;
colDef = new string[i];
上面不知道行不行。试一下。
不过一般都用 ArrayList
可以使用动态指定!
如:
abc;//是你的数组
colDef=new String[abc.Length];//动态创建
或者
int i=10;//确定大小的数组
colDef=new String[i];//动态创建
ArrayList也有利弊,操作是方便了,但是数据需要转换,呵呵!我感觉比较麻烦!
string[] sa;
int c = 100;
sa = new string[c];
可以这样使用,我昨天刚刚试过,很方便的。
可以这么使用,原理还是一样的!
动态指定!
abc;//是你的数组
tableStruct tab=new tableStruct();
tab.colDef=new String[abc.Length];//动态创建
或者
int i=10;//确定大小的数组
tableStruct tab=new tableStruct();
tab.colDef=new String[i];//动态创建
看到了吗?