可访问性不一致:参数类型不是方法不易进入 [英] Inconsistent Accessibility: Parameter type is less accessible than method

查看:199
本文介绍了可访问性不一致:参数类型不是方法不易进入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想两种形式之间传递一个对象(到当前登录用户的引用,基本上)。此刻,我沿着这些线路中的登录表单的内容:

I'm trying to pass an object (a reference to the currently logged on user, basically) between two forms. At the moment, I have something along these lines in the login form:

private ACTInterface oActInterface;

public void button1_Click(object sender, EventArgs e)
    {
        oActInterface = new ACTInterface(@"\\actserver\Database\Premier.pad",this.textUser.Text,this.textPass.Text);

        if (oActInterface.checkLoggedIn())
        {
            //user has authed against ACT, so we can carry on
            clients oClientForm = new clients(oActInterface);
            this.Hide();
            oClientForm.Show();
        }
        else...

下一个表单(客户端)上,我有:

on the next form (clients), I have:

public partial class clients : Form
{
    private ACTInterface oActInt {get; set;}

    public clients(ACTInterface _oActInt)

...这将导致我越来越:

...which results in me getting:

Error   1   Inconsistent accessibility: 
parameter type 'support.ACTInterface' is less accessible than method    
'support.clients.clients(support.ACTInterface)'  
c:\work\net\backup\support\support\clients.cs   20  16  support

我真的不明白是什么问题 - 这两个领域都是私有的,从形式相关的公共方法来访问。谷歌搜索并没有真正帮助,因为它只是对一个元素是公众和其他私人,这是不是这里的情况百分点。

I don't really understand what the problem is - both fields are private, and accessed by the relevant public method from the form. Googling doesn't really help, as it just points towards one element being public and the other private, which isn't the case here.

任何人帮助吗?

推荐答案

公共客户是构造公共,但它有一个类型的参数 ACTInterface 私人 (它嵌套在一个类?)。你不能做到这一点。你需要让 ACTInterface 至少访问为客户

Constructor of public class clients is public but it has a parameter of type ACTInterface that is private (it is nested in a class?). You can't do that. You need to make ACTInterface at least as accessible as clients.

这篇关于可访问性不一致:参数类型不是方法不易进入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆