【发布时间】:2011-07-05 18:43:38
【问题描述】:
我试图从一个类中返回对象列表并得到以下错误:
Error 1 Inconsistent accessibility: property type 'System.Collections.Generic.List<EventXmlExtract.Attribute>' is less accessible than property 'EventXmlExtract.EventExtract.AttributeList' C:\Documents and Settings\eyalk\My Documents\Visual Studio 2010\Projects\Blobs\EventExtractDll\EventExtract.cs 14 32 EventExtractDll
我的代码尝试返回 _attributeList:
public class EventExtract
{
private string _type;
private int _type_id;
private List<Attribute> _attributeList = new List<Attribute>();
internal List<Attribute> AttributeList
{
get { return _attributeList; }
set { _attributeList = value; }
}
}
有什么问题?以及如何检索列表?
【问题讨论】:
-
Attribute是什么类?我强烈怀疑它不是 System.Attribute 类 -
那么问题就来了。使该属性类至少为“内部”,代码将编译得很好
-
能否请您显示它的定义,因为这是问题的根本原因。
-
我刚刚在下面更新了我的答案。试一试并报告。