class Class1
    {
        private static string _a = null;
        private static int _b = 0;
        private static ParameterDirection _c;
        public  string SetA
        {
            set { _a = value; }
            get { return _a; }
        }        public  int SetB
        {
            set { _b = value; }
            get { return _b; }
        }        public  ParameterDirection SetC
        {
            set { _c = value; }
            get{return _c;}
        }
    }
 static void Main(string[] args)
        {
            Class1 cls = new Class1();
            cls.SetA = "AA";
            cls.SetB = 1;
            cls.SetC = System.Data.ParameterDirection.Output;            List<Class1> lst = new List<Class1>();
            table.Add(cls);
            foreach (object obj in lst)
            {
                //这里该怎么遍历lst中Class1的属性值呢?我要得到AA,1,output
                //反射用的不多,看了些资料,是能得到方法名啊,属性字段之类的,我要获得属性中的值
                  //或者你可以用你知道的方法告诉我,谢谢!在线等!
            }            
        }

解决方案 »

  1.   

    foreach (object obj in lst)
    {     
           Class1 cs = obj;
          string A = cs.SetA;
    }   
      

  2.   


    foreach(Class1 c in lst)
    {
        ***=c.SetA;
        ***=c.SetB;
        .....
    }
      

  3.   

    static void Main(string[] args)
            {
                Class1 cls = new Class1();
                cls.SetA = "AA";
                cls.SetB = 1;
                cls.SetC = System.Data.ParameterDirection.Output;            List<Class1> lst = new List<Class1>();
                table.Add(cls);            foreach (Class1 obj in lst)
                {
                    Console.WriteLine(obj.SetA);
                    Console.WriteLine(obj.SetB);
                }            
            }
      

  4.   

    你已经使用List<Class>了所以 lst[0]就是Class的实例