我试图从类返回的对象列表,并获得以下错误:C# - 无法返回列表
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类 – SWeko 2011-02-28 13:30:56
它是自定义类 – kaycee 2011-02-28 13:32:37
那么就有问题了。使该属性类至少为'内部',代码将编译得很好 – yas4891 2011-02-28 13:35:30