2014-09-04 67 views
-3

当我试图让List公开,像这样:可访问性不一致申请类型system.collections.generic.list

public List<Enemy> enemies; 

我得到了以下错误:

Inconsistent accessibility: field type 'System.Collections.Generic.List'...

+0

等级敌人不公开... – 2014-09-04 19:58:09

+0

好吧,如果你的班级'Enemy'不是出版社,那么这将回答你自己的问题。 – MethodMan 2014-09-04 19:59:50

+1

如果你打算提到你问的问题,甚至2个小时前,至少链接到它。 – 2014-09-04 20:11:26

回答

3

这可能是因为Enemy不是public

Compiler Error CS0052

The type of a field cannot be less accessible than the field itself because all public constructs must return a publicly accessible object.

0

你的班级“敌人”可达性是什么?如果您正在使用对象列表,它应该是公开的。

+2

它不应该公开,因为他使用的是一个对象列表,它应该是公开的,因为有一个公共字段。 – 2014-09-04 20:02:07

相关问题