【发布时间】:2013-02-01 21:19:52
【问题描述】:
当我运行我的 C# 应用程序时,它显示以下错误
可访问性不一致:参数类型“timesheet.libs.DbObject”的可访问性低于方法“timesheet.model.usertimesheet.usertimesheet(timesheet.libs.DbObject)”C:\Users\user\Desktop\Interface+ code\Interface+code\timesheet\model\usertimesheet.cs
可访问性不一致:参数类型“timesheet.libs.DbObject”的可访问性低于方法“timesheet.MainFormMDI.setdbobject(timesheet.libs.DbObject)”C:\Users\user\Desktop\Interface+code\接口+代码\timesheet\MainFormMDI.cs
可访问性不一致:参数类型“timesheet.libs.DbObject”的可访问性低于方法“timesheet.model.user.user(timesheet.libs.DbObject)”C:\Users\user\Desktop\Interface+ code\Interface+code\timesheet\model\user.cs
可访问性不一致:参数类型“timesheet.libs.DbObject”的可访问性低于方法“timesheet.model.project.project(timesheet.libs.DbObject)”C:\Users\user\Desktop\Interface+ code\Interface+code\timesheet\model\project.cs
我有一个 login.cs 的 sn-p
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 和用户类更改为 public,但没有任何改变。我想将 userobject 和 dbobject 传递给 MainFormMDI 类,以便能够对这些对象执行进一步的操作。我很高兴听到您的修复。
【问题讨论】:
-
应该可以的。您传递的
dbobject来自哪里,它的可访问性是什么? -
我认为您需要向我们展示
timesheet.libs中的相关代码。 -
我的回答是否解决了您的问题?
标签: c#