![](/img/trans.png)
[英]Why am I getting the error Error 1 Inconsistent accessibility: return type?
[英]Why am I getting inconsistent accessibility in this class?
所以,我正在嘗試創建這樣的學校課程模型,但是我一直在列表中收到此錯誤
可訪問性不一致:屬性類型“列表”的訪問權限比屬性“ Course.Students”少
public enum CourseName
{
MATHEMATICS = 1,
PHYSICS,
CHEMISTRY
}
public partial class Course
{
public int ID {get; set;}
public CourseName Name {get; set;}
public List<Student> Students {get; set;} // error on this Line
}
誰能告訴我我在做什么錯?
您的班級學生沒有訪問修飾符,只需在班級名稱Student前面添加public
關鍵字
public class Student{
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.