我試圖從類返回的對象列表,並獲得以下錯誤: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