不一致的可訪問性:參數類型的可訪問性不如方法 - Inconsistent Accessibility: Parameter type is less accessible than method

問題:

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.谷歌搜索並沒有真正的幫助,因爲它只是指出一個元素是公共的,另一個是私有的,這裏不是這種情況。

Anybody help?有人幫忙嗎?


解決方案:

參考一: https://stackoom.com/question/Q8Zs
參考二: Inconsistent Accessibility: Parameter type is less accessible than method
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章