I'm trying to create a list of class instances for storing information, but I'm getting this error:
Error 1 Inconsistent accessibility: property type 'System.Collections.Generic.List<POS_System.ReportReciepts>' is less accessible than property 'POS_System.Reports24Hours.recieptlist'
Any clue why? I've tried figuring out but I have no idea whats throwing this. Heres my code where the error is being thrown and my class. Thanks!
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; }
}
You need to make
ReportReciepts
public
. The default access modifier for a class isinternal
, but you're attempting to return aList
ofReportReciepts
from apublic
property. Any type exposed via a public property must itself be public.Your ReportReceipts needs to be Public. Essentially you're making a public list of items, but the type of item is private, so no one can see it. This should work: