當我嘗試編譯下面的代碼我得到一個CS0052錯誤:C#錯誤CS0052,可訪問性不一致
struct mp3
{
public int ID, MBSize;
public string Make, Model, Price;
public mp3(int ID, int voorraad, int MBSize, string Make, string Model, string Price)
{
this.ID = ID;
this.MBSize = MBSize;
this.Make = Make;
this.Model = Model;
this.Price = Price;
}
}
public class Acess
{
static public List<mp3> mp3List = new List<mp3>();
static public void laadMP3()
{
// ...
}
}
Error 1 Inconsistent accessibility: field type 'System.Collections.Generic.List' is less accessible than field 'SoundSharp___opdracht_3.Acess.mp3List'
嘗試使用一致的方法來訪問修飾符,例如始終指定一個(private,protected,public,internal),並始終在該行的開頭指定它們。這將有助於調試將來的問題。 –