可访问性不一致C#

时间:2015-05-28 23:18:03

标签: c# accessibility

我正在开发跟踪股票的自定义用户界面,虽然我制作的一个用户界面导致了一个我无法找到的问题。我一直收到错误:“不一致的可访问性:参数类型'SCM_Addin.Funds.TrackFund []'比方法'SCM_Addin.Forms.frm_FundTracker.frm_FundTracker(SM_Addin.Funds.TrackFund [])'

更难访问

我已经检查了我的类中的保护,但是我找不到任何会阻碍我的代码中的可访问性的私有变量。这是代码:

frm_FundTracker:

<input type="date" name=... >

{     公共部分类frm_FundTracker:表单     {

namespace SCM_Addin.Forms

}

基金类:

    public frm_FundTracker()
    {
        InitializeComponent();
    }

    public frm_FundTracker(String[] fundsToAdd, Double[] ePrices, Double[] cPrices)
    {

        InitializeComponent();

        int index = 0;
        foreach (String fund in fundsToAdd)
        {

            ListViewItem newFundItem = new ListViewItem(fund);
            newFundItem.SubItems.Add(ePrices[index].ToString());
            newFundItem.SubItems.Add(cPrices[index].ToString());

            this.list_Tracker.Items.Add(newFundItem);

            index++;

        }//END LOADING COLUMNS


    }//END FRM_FUNDTRACKER WITH ARRAYS

    public frm_FundTracker(TrackFund[] funds)
    {
        InitializeComponent();

        foreach (TrackFund fund in funds)
        {
            ListViewItem newFundItem = new ListViewItem(fund.symbol);
            newFundItem.SubItems.Add(fund.entryPrice.ToString());
            newFundItem.SubItems.Add(fund.currentPrice.ToString());

            this.list_Tracker.Items.Add(newFundItem);
        }
    }//END FRM_FUNDTRACKER WITH FUNDS

    private void btn_Done_Click(object sender, EventArgs e)
    {

        if (MessageBox.Show("Close Form?", "Close Form?", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
        {
            this.Dispose();
        } 

    }

}

TrackFund类(扩展基金)

namespace SCM_Addin
{
class Fund
{

    public String symbol { get; set; } //Symbol of the fund to be used
    private int fundRow { get; set; } //Fund's spot in the Stats Sheet.
    private String url1, url2, url3;
    private HtmlAgilityPack.HtmlDocument doc;
    private DataPuller puller;
    private Dictionary<String, String> fundStats;
    private SqlConnection conn;

    public Fund(String sym)
    {

        this.symbol = sym;
        this.doc = new HtmlAgilityPack.HtmlDocument();
        this.puller = new DataPuller();
        this.url1 = "http://finance.yahoo.com/q?s=" + this.symbol;
        this.url2 = "http://finance.yahoo.com/q/ks?s=" + this.symbol;
        this.url3 = "http://www.profitspi.com/stock-quote/" + this.symbol + ".aspx";
        this.fundStats = new Dictionary<string, string>();
        this.conn = null;


    }

这是我第一次真正在C#中扩展一个类,所以如果我扩展错误,我猜可能就是这样。

2 个答案:

答案 0 :(得分:3)

Default accessibility for a class will be internal,所以:

convertPoint:toView:

......应该是

class Fund
//and
class TrackFund : Fund

答案 1 :(得分:1)

TrackFund课程公开。

public class TrackFund : Fund
{
 ....
}