当我运行我的 C# 应用程序时,它显示以下错误
可访问性不一致:参数类型“timesheet.libs.DbObject”比方法“timesheet.model.usertimesheet.usertimesheet(timesheet.libs.DbObject)”更难访问 C:\Users\user\Desktop\Interface+code\Interface+code\时间表\模型\usertimesheet.cs
可访问性不一致:参数类型“timesheet.libs.DbObject”比方法“timesheet.MainFormMDI.setdbobject(timesheet.libs.DbObject)”更难访问 C:\Users\user\Desktop\Interface+code\Interface+code\timesheet\ MainFormMDI.cs
可访问性不一致:参数类型“timesheet.libs.DbObject”比方法“timesheet.model.user.user(timesheet.libs.DbObject)”更难访问 C:\Users\user\Desktop\Interface+code\Interface+code\时间表\模型\user.cs
可访问性不一致:参数类型“timesheet.libs.DbObject”的可访问性低于方法“timesheet.model.project.project(timesheet.libs.DbObject)”C:\Users\user\Desktop\Interface+code\Interface+code\时间表\模型\project.cs
我有一段 login.cs 作为
MainFormMDI mainform = new MainFormMDI();
mainform.setdbobject(dbobject);
mainform.setuserobject(userobj);
mainform.Show();
MainFormMDI.cs
:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using timesheet.model;
using timesheet.libs;
namespace timesheet
{
public partial class MainFormMDI : Form
{
private DbObject dbobject;
private user userobj;
public MainFormMDI( )
{
InitializeComponent();
}
public void setdbobject(DbObject dbobject)
{
this.dbobject = dbobject;
}
public void setuserobject(user userobj)
{
this.userobj = userobj;
}
private void MainFormMDI_Load(object sender, EventArgs e)
{
}
private void adminPanelToolStripMenuItem_Click(object sender, EventArgs e)
{
}
}
}
我尝试了其他解决方案,例如将 dbobject 和 user 类更改为 public,但没有任何改变。我想将 userobject 和 dbobject 传递给 MainFormMDI 类,以便能够对这些对象执行进一步的操作。我会很高兴听到你的修复。