这是我在单击按钮时创建第二个表单的代码部分。
private List<Team> Teams = new List<Team>();
private void button2_Click(object sender, EventArgs e)
{
Form Form2 = new Form2(Teams);
Form2.Show();
}
表格 2:
public Form2(List<Team> teams)
{
InitializeComponent();
}
而且我总是得到这个错误:
Error 1 Inconsistent accessibility: parameter type '
System.Collections.Generic.List<Projekt.Team>
' is less accessible than method 'Projekt.Form2.Form2(System.Collections.Generic.List<Projekt.Team>)
'
最佳答案
Team
很可能是 internal
,因此它不能出现在 public< 上的
类。public
方法的签名中
您可以将 Team
公开或方法 private
/internal
。
关于c# - 通用列表不一致的可访问性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13345040/