我正在爲跟蹤股票的自定義用戶界面工作,儘管我製作的一個UI導致了一個我找不到的問題。我不斷收到錯誤:「可訪問性不一致:參數類型 'SCM_Addin.Funds.TrackFund []' 是比方法更少可訪問的 'SCM_Addin.Forms.frm_FundTracker.frm_FundTracker(SM_Addin.Funds.TrackFund [])'不一致的可訪問性C#
I」已經檢查了保護我的班,但我無法找到任何私有變量會妨礙在我的代碼可訪問以下是代碼:
frm_FundTracker:
namespace SCM_Addin.Forms
{ 公共部分類frm_FundTracker :表格 {
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();
}
}
}
}
基金類別:
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;
}
TrackFund類(擴展基金)
namespace SCM_Addin.Funds
{
class TrackFund : Fund
{
public double entryPrice { get; set; }
public double currentPrice { get; set; }
public TrackFund(String sym, double entryP, double curP) : base(sym)
{
this.entryPrice = entryP;
this.currentPrice = curP;
}
}
}
這是我第一次真正延長在C#中的一類,因此,如果我米錯誤,我想這可能是。
...我會爬現在進入一個洞... – jDave1984
發生在我們所有人身上。 :-D – Colin