更新时间:2022-10-23 16:25:55
团队
最可能内部
,所以它不能在一个公共
方法的签名出现在公共
类。
您也可以制作团队
公开或方法私人
/ 内部
。
Here is the part of the code where I create a second form on a button click.
private List<Team> Teams = new List<Team>();
private void button2_Click(object sender, EventArgs e)
{
Form Form2 = new Form2(Teams);
Form2.Show();
}
Form 2:
public Form2(List<Team> teams)
{
InitializeComponent();
}
And I'm always getting back this error:
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
is most likely internal
, so it can't appear in the signature of a public
method on a public
class.
You can either make Team
public or the method private
/internal
.