0

情報を格納するクラス インスタンスのリストを作成しようとしていますが、次のエラーが発生します。

Error 1 Inconsistent accessibility: property type 'System.Collections.Generic.List<POS_System.ReportReciepts>' is less accessible than property 'POS_System.Reports24Hours.recieptlist'

理由はありますか?考えてみましたが、何がこれを投げているのかわかりません。エラーがスローされているコードとクラスを次に示します。ありがとう!

public partial class Reports24Hours : Form
{
    string category = "";
    public int WhichReciept = 0;
    public static List<ReportReciepts> recieptlist { get; set; } //Error here
    ...
}

.

class ReportReciepts
{
    public string[] Quantity { get; set; }
    public string[] ItemName { get; set; }
    public string[] Price { get; set; }
}
4

2 に答える 2

1

ReportReceipts は Public である必要があります。基本的に、アイテムの公開リストを作成していますが、アイテムのタイプは非公開であるため、誰も見ることができません。これはうまくいくはずです:

public partial class Reports24Hours : Form
{
    string category = "";
    public int WhichReciept = 0;
    public static List<ReportReciepts> recieptlist { get; set; } //Error here
    ...
}



public class ReportReciepts
{
    public string[] Quantity { get; set; }
    public string[] ItemName { get; set; }
    public string[] Price { get; set; }
}
于 2013-11-14T19:01:10.803 に答える
0

作る必要がありますReportReciepts public。クラスのデフォルトのアクセス修飾子はですが、プロパティからinternalを返そうとしてListいます。パブリック プロパティを介して公開される型は、それ自体がパブリックである必要があります。ReportRecieptspublic

于 2013-11-14T19:00:49.757 に答える