C# 嵌套对象列表,最后一个列表不可访问?

C# 嵌套对象列表,最后一个列表不可访问?,c#,list,nested,C#,List,Nested,在下面的代码中,我尝试将AttributeValueInfoEntity添加到AttributeValueExportList中,但是它没有显示为ArticleAttributeExportLarge对象在代码中放置//largeExportList.AttributeExportList的位置的属性 我是做错了什么,还是在C#中遗漏了一条重要的嵌套规则 public分部类导出\u文章\u默认值:System.Web.UI.Page { 受保护的无效页面加载(对象发送方、事件参数e

在下面的代码中,我尝试将
AttributeValueInfoEntity
添加到
AttributeValueExportList
中,但是它没有显示为
ArticleAttributeExportLarge
对象在代码中放置
//largeExportList.AttributeExportList
的位置的属性

我是做错了什么,还是在C#中遗漏了一条重要的嵌套规则

public分部类导出\u文章\u默认值:System.Web.UI.Page
{       
受保护的无效页面加载(对象发送方、事件参数e)
{
ArticleInfoEntity[]articleInfoList=ArticleInfoFactory.Instance.ListInfo(244);
列表=新列表();
foreach(articleInfoList中的ArticleInfoEntity aie)
{
ArticleExportLarge导出列表=新ArticleExportLarge(aie);
largeExportList.AttributeExportList=新列表();
List AttributeInfo列表=AttributeInfo工厂.Instance.ListByArticle(aie.ArticleId);
foreach(attributeInfo列表中的attributeInfo实体attributeInfo)
{
添加(新的ArticleAttributeExportLarge(attributeInfo));
List ArticleValueInfoList=AttributeValueInfoFactory.Instance.ListByArticleAndAttribute(aie.ArticleId,attributeInfo.AttributeId);
foreach(AttributeValueInfoEntity avie在ArticleValueInfoList中)
{
//largeExportList.AttributeExportList
}
}
列表。添加(大出口列表);
}   
}
}
公共类文章
{
私人articleInfo实体articleInfo;
私有列表属性ExportList;
公共ArticleExportLarge(ArticleInfoEntity articleInfo)
{
this.articleInfo=articleInfo;
}
[XmlElement(ElementName=“attributeList”)]
公共列表属性ExportList
{
获取{return attributeExportList;}
设置{attributeExportList=value;}
}
}
公共类ArticleAttributeExportLarge
{
私有属性信息实体属性信息;
私有列表attributeValueExportList;
public ArticleAttributeExportLarge(attributeInfo实体attributeInfo)
{
this.attributeInfo=attributeInfo;
}
[XmlElement(ElementName=“attributeValueList”)]
公共列表属性值导出列表
{
获取{return attributeValueExportList;}
设置{attributeValueExportList=value;}
}
}
公共类ArticleAttributeValueExportLarge
{
私有AttributeValueInfoEntity attributeValueExportEntity;
公共属性ValueInfoEntity属性ValueExportEntity
{
获取{return attributeValueExportEntity;}
设置{this.attributeValueExportEntity=value;}
}
}

我发现了我的错误。如果要访问该列表中的对象,我需要遍历辅助列表
largeExportList.AttributeExportList

public partial class Export_Articles_Default : System.Web.UI.Page
{       
    protected void Page_Load(object sender, EventArgs e)
    {
            ArticleInfoEntity[] articleInfoList = ArticleInfoFactory.Instance.ListInfo(244);
            List<ArticleExportLarge> list = new List<ArticleExportLarge>();

            foreach (ArticleInfoEntity aie in articleInfoList)
            {
                ArticleExportLarge largeExportList = new ArticleExportLarge(aie);
                largeExportList.AttributeExportList = new List<ArticleAttributeExportLarge>();

                List<AttributeInfoEntity> attributeInfoList = AttributeInfoFactory.Instance.ListByArticle(aie.ArticleId);


                foreach (AttributeInfoEntity attributeInfo in attributeInfoList)
                {
                    largeExportList.AttributeExportList.Add(new ArticleAttributeExportLarge(attributeInfo));
                    List<AttributeValueInfoEntity> ArticleValueInfoList = AttributeValueInfoFactory.Instance.ListByArticleAndAttribute(aie.ArticleId, attributeInfo.AttributeId);

                    foreach (AttributeValueInfoEntity avie in ArticleValueInfoList)
                    {
                       //largeExportList.AttributeExportList
                    }
                }

                list.Add(largeExportList);
            }   
        }
}

public class ArticleExportLarge
{
    private ArticleInfoEntity articleInfo;
    private List<ArticleAttributeExportLarge> attributeExportList;

    public ArticleExportLarge(ArticleInfoEntity articleInfo)
    {
        this.articleInfo = articleInfo;
    }

    [XmlElement(ElementName = "attributeList")]
    public List<ArticleAttributeExportLarge> AttributeExportList
    {
        get { return attributeExportList; }
        set { attributeExportList = value; }
    }

}

public class ArticleAttributeExportLarge
    {
        private AttributeInfoEntity attributeInfo;
        private List<ArticleAttributeValueExportLarge> attributeValueExportList;

        public ArticleAttributeExportLarge(AttributeInfoEntity attributeInfo)
        {
            this.attributeInfo = attributeInfo;
        }

        [XmlElement(ElementName = "attributeValueList")]
        public List<ArticleAttributeValueExportLarge> AttributeValueExportList
        {
            get { return attributeValueExportList; }
            set { attributeValueExportList = value; }
        }
    }

public class ArticleAttributeValueExportLarge
{
    private AttributeValueInfoEntity attributeValueExportEntity;

    public AttributeValueInfoEntity AttributeValueExportEntity
    {
        get { return attributeValueExportEntity; }
        set { this.attributeValueExportEntity = value; }
    }

}