定义了zd,然后怎么在原来传值的基础上再加一个值!
string[] zd = {"Name"};
conInsAuto("Big", zd );然后将该值传到一个方法里:
public bool conInsAuto(string TableName  ,  string[] ziduan)
{
   //在这里怎么在原来传值的基础上再加一个值!
  ziduan + = {"ID"};
  
   ...................
   return true;
}
求高人帮忙解决!谢谢!

解决方案 »

  1.   

    是什么意思啊?楼上的兄弟其实我的意思很简单,就是想再    ziduan {"Name", 加上 "ID" }; 这样而已呀
      

  2.   

    ArrayList zd = new ArrayList();
    zd.Add("Big");
    Zd.Add("ID");
      

  3.   

    public bool conInsAuto(string TableName  , ref  string[] ziduan)  加上ref 说明参数是按照饮用传递的  调用时 参数数组会保留值
      

  4.   

    回AllenTing(我爱吃醋) :
    然后在方法里边怎么加一个为"id"的值回AllenTing(我爱吃醋) ( :
    G:\SQL\SQL.cs(248): “System.Array”并不包含对“Add”的定义
    G:\SQL\SQL.cs(247): 不能在此范围内声明名为“ziduan”的局部变量,因为这样会使“ziduan”具有不同的含义,而它已经用于“父级或当前”范围以表示其他内容
    G:\SQL\SQL.cs(247): 无法将类型“System.Collections.ArrayList”隐式转换为“string[]”
      

  5.   

    回 YAOTIEBING(我爱我家) : 然后在方法里边怎么加一个为"id"的值
      

  6.   

    C#好像没有动态数组,只有ArrayList.
      

  7.   

    Help!!!!!!!!!具体怎么解决呢?兄弟们 救命呀
      

  8.   

    ArrayList a=new ArrayList();
    a.Add("name");
    a.Add("ID");
      

  9.   

    你都用ArrayList不就可以了,添加非常方便!
      

  10.   

    可以用HashTabel
    hashtable.add(id,velue)健值是一对一对的
      

  11.   

    HashTabel是可以动态增加的
    HashTabel hstb=new HashTabel()
      

  12.   

    using System;namespace ConsoleApplication7
    {
    /// <summary>
    /// Class1 的摘要说明。
    /// </summary>
    class Class1
    {
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main(string[] args)
    {
    //
    // TODO: 在此处添加代码以启动应用程序
    //
    System.Collections.ArrayList arr=new System.Collections.ArrayList();
    add("aa",ref arr);
    add("bb",ref arr);
    for(int i=0;i<arr.Count;i++)Console.WriteLine(arr[i].ToString());
    Console.ReadLine(); } public static void add(string s,ref System.Collections.ArrayList arr)
    {
    arr.Add(s);
    }
    }
    }
      

  13.   

    public string[] conInsAuto(string TableName  ,  string[] ziduan)
    {
       //在这里怎么在原来传值的基础上再加一个值!
      ArrayList al = new ArrayList();
      int i;
    for (i = 0 ; i < ziduan.GetLength();++i)
    {
    al.Add(ziduan[i]);
    }
    al.Add(TableName);
          return al.ToArray(typeof(string));
    }
      

  14.   

    //如果非要用string[], 可以这样:(但建议使用ArrayList等)
    string[] zd = {"Name"};
    conInsAuto("Big", ref zd );public bool conInsAuto(string TableName  ,  ref string[] ziduan)
    {
        string[] temp = new string[ziduan.length+1];
        ziduan.CopyTo(temp, temp.Length);
        temp[ziduan.length] = "ID";
        ziduan= temp;
       ...................
       return true;
    }
      

  15.   

    上面错了//如果非要用string[], 可以这样:(但建议使用ArrayList等)
    string[] zd = {"Name"};
    conInsAuto("Big", ref zd );public bool conInsAuto(string TableName  ,  ref string[] ziduan)
    {
        string[] temp = new string[ziduan.length+1];
        ziduan.CopyTo(temp, ziduan.Length);
        temp[ziduan.length] = "ID";
        ziduan= temp;
       ...................
       return true;
    }
      

  16.   


    //如果非要用string[], 可以这样:(但建议使用ArrayList等)
    string[] zd = {"Name"};
    conInsAuto("Big", ref zd );public bool conInsAuto(string TableName  ,  ref string[] ziduan)
    {
        string[] temp = new string[ziduan.length+1];
        ziduan.CopyTo(temp, 0);
        temp[ziduan.length] = "ID";
        ziduan= temp;
       ...................
       return true;
    }