不一致的可访问性:参数类型“x”比方法“y”更容易访问。

时间:2022-12-30 16:05:05
public partial class Autobuyer : Form
{

   Client AbClient;
    public Autobuyer(Client cli)
    {
        InitializeComponent();

        AbClient = cli;
    }

The function in which is throwing up the error.

函数在其中抛出错误。

public class Client {
}

Client is the class where the problem seems to be.

客户端是问题所在的类。

private void CheckAuth()
    {
        while (true)
        {
            if (!sAuth.IsAlive)
            {
                if(abClient.isAuthSucessful)
                    Application.Run(new Autobuyer(abClient));
                break;  
            } 
        }
    }

This is where the Autobuyer form is called from. (Inside the first form which is started by the main())

这就是调用Autobuyer表单的地方。(第一种形式由main()开始)

I still don't know how to fix this, I've of course searched but no one seems to have the answer that works in my situation.

我仍然不知道该怎么解决这个问题,我当然找过了,但似乎没有人能在我的情况下找到答案。

1 个解决方案

#1


8  

I think your AbClient needs to be declared as public, as at the moment it's private by default. See MSDN - "The return type and parameter types of a method must be at least as accessible as the method itself."

我认为您的AbClient需要声明为public,就像在默认情况下它是私有的。请参见MSDN——“方法的返回类型和参数类型必须至少与方法本身一样可访问。”

#1


8  

I think your AbClient needs to be declared as public, as at the moment it's private by default. See MSDN - "The return type and parameter types of a method must be at least as accessible as the method itself."

我认为您的AbClient需要声明为public,就像在默认情况下它是私有的。请参见MSDN——“方法的返回类型和参数类型必须至少与方法本身一样可访问。”