Dave

Dave

  • NA
  • 161
  • 0

Accessibility of the Generic List

Dec 21 2007 8:06 PM
Hi There,

I get the following error when I pass a parameter of the type System.Collections.Generic.List (i.e. List <T>) to the constructor of a form:
Error    1    Inconsistent accessibility: parameter type 'System.Collections.Generic.List<CustomerWeightTracker.Client>' is less accessible than method 'CustomerWeightTracker.Report.Report(System.Collections.Generic.List<CustomerWeightTracker.Client>)'    D:\bigAl\CustomerWeightTracker\CustomerWeightTracker\Report.cs    16    16    CustomerWeightTracker
The fix was easy - I just changed the access modifier of the constructor to internal. But I don't understand why that happens, and how the fix makes it work. Trial and error won the day, but I would like to understand what was going on.

Note, it only happens with the generic list. Other types were fine (e.g. ints, user-defined objects etc).

I'd love to get an understanding here.

Thanks

Answers (4)