循环类里面的每一个属性

         

   Type type = typeof(类名);

            System.Reflection.PropertyInfo[] myPropertyInfo;
            myPropertyInfo = type.GetProperties();

            for (int i =0; i < myPropertyInfo.Length; i++)
            {
                     Amount amount= (Amount)myPropertyInfo[i].GetValue(Statictis, null);

                    amount.CDF= Math.Round(amount.CDF, 2);

                    myPropertyInfo[i].SetValue(Statictis, amount, null);
                
            }
       

你可能感兴趣的:(循环)