【发布时间】:2013-05-07 13:44:48
【问题描述】:
在将此代码写入我的项目时,我收到了以下错误:
错误 1 可访问性不一致:字段类型
'System.Collections.Generic.List<Jain_milan.Childrendata>'的可访问性低于字段'Jain_milan.addchild.m_children'
错误 2 可访问性不一致:参数类型'System.Collections.Generic.List<Jain_milan.Childrendata>'的可访问性低于方法'Jain_milan.addchild.addchild(System.Collections.Generic.List<Jain_milan.Childrendata>)'
namespace Jain_milan
{
public partial class addchild : Form
{
List<Label> label = new List<Label>();
List<TextBox> textbox = new List<TextBox>();
List<ComboBox> combobox = new List<ComboBox>();
List<DateTimePicker> datetimepicker = new List<DateTimePicker>();
public List<Childrendata> m_children = new List<Childrendata>();
public addchild(List<Childrendata> children)
{
InitializeComponent();
this.m_children = children; //Initialize the same List as sent by Mainform
}
【问题讨论】:
-
邮件的哪一部分你不明白?
-
仔细检查您正在使用的类的访问修饰符。
-
表示公共项目使用私有类型。确保访问修饰符一致
-
@VJain:你能理解并解决这个问题吗?
标签: c#