我搜索了一些论坛和主题以寻找答案,但我无法找到我的问题的解决方案。我将发布代码:
namespace Configurator
{
public partial class Dialog : Form
{
private DataStorage dataStorage = null;
public Dialog
{
InitializeComponent();
}
public void setDataStorage(ref DataStorage ds)
{
this.dataStorage = ds;
}
}
}
它正在这个类中使用:
namespace Configurator
{
public partial class MainView : Form
{
private DataStorage dataStorage = new DataStorage();
private Dialog DialogBox = new Dialog();
public MainView
{
InitializeComponent();
}
private void newObjectButton_Click(object sender, EventArgs e)
{
DialogBox.Show();
DialogBox.setDataStorage(ref dataStorage);
}
}
}
这是错误: 不一致的可访问性:参数类型'ref Configurator.DataStorage'比方法Configurator.Dialog.setDataStorage(ref Configurator.DataStorage)更难访问