请问,在c#中有实现动态参数的技术,或是解决方案吗?
有,就请说明,最好有代码。
没有,可以谈谈自己的意见阿。

解决方案 »

  1.   

    c# 动态参数1.
    using System;
    public class MyClass 
    {    public static void UseParams(params int[] list) 
        {
            for (int i = 0 ; i < list.Length; i++)
            {
                Console.WriteLine(list[i]);
            }
            Console.WriteLine();
        }    public static void UseParams2(params object[] list) 
        {
            for (int i = 0 ; i < list.Length; i++)
            {
                Console.WriteLine(list[i]);
            }
            Console.WriteLine();
        }    static void Main() 
        {
            UseParams(1, 2, 3);
            UseParams2(1, 'a', "test");         // An array of objects can also be passed, as long as
            // the array type matches the method being called.
            int[] myarray = new int[3] {10,11,12};
            UseParams(myarray);
        }
    }
    输出
    1
    2
    31
    a
    test10
    11
    12
      

  2.   

    如果你指的是不定量的参数的话,那就支持 
    在MSDN里查一下params关键字就知道了