IList list = ParameterManager.GetParametersByproductId(productId);
我已经通过一个方法将对象放入list中,现在如何用循环取出对象,以及对象中的属性值?

解决方案 »

  1.   

    foreach(object obj in list)
    {
         //todo
    }
      

  2.   

    请大家给我指点指点,源码如下……
    IList<Parameters> list = ParameterManager.GetParametersByproductId(productId);           
                for (int i = 1; i <= list.Count; i++)
                {
                    Parameters parameters=list[i];                
                    TextBox txtparameter = (TextBox)Master.FindControl("ContentPlaceHolder1").FindControl("tbParameter").FindControl("txtParameter" + i.ToString());
                    txtparameter.Text = parameters.ProductId;
                    TextBox txtunit = (TextBox)Master.FindControl("ContentPlaceHolder1").FindControl("tbParameter").FindControl("txtUnit" + i.ToString());
                    txtunit.Text = parameters.Unit;
                    TextBox txtstandard = (TextBox)Master.FindControl("ContentPlaceHolder1").FindControl("tbParameter").FindControl("txtstandard" + i.ToString());
                    txtstandard.Text = parameters.Standard;
                }
      

  3.   

    txtparameter.Text = parameters.ProductId.ToString();
    这句提示错误:未将对象引用设置到对象的实例。
      

  4.   

    不要使用这个接口,已经逐步不使用了。使用泛型接口就可以达到你的要求了。
    IList<你的类型> list = ParameterManager.GetParametersByproductId(productId);