By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,783 Members | 1,347 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,783 IT Pros & Developers. It's quick & easy.

Problem passing List<T>

P: n/a
HI all I have a Method that I wish to pass a generic List as a
parameter,

Expand|Select|Wrap|Line Numbers
  1. public void Test (List<Client> temp)
  2. {
  3. this.ClaimBindingSource.DataSource = temp;
  4. }
  5.  
The idea is then to bind it for a data report.

But upon trying to compile i get the following error

Error 1 Inconsistent accessibility: parameter type
'System.Collections.Generic.List<Indemnity_System. Client>' is less
accessible than method
'Indemnity_System.ReportView.Test(System.Collectio ns.Generic.List<Indemnity_System.Client>)'
If I use an ArrayList I do not get this problem any help would be great.

May 18 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Presumably, then, Indemnity_System.Client is scoped as internal.
ArrayList doesn't fail because the type is not exposed in the interface.
Either make Indemnity_System.Client public, or make the method internal
(since you won't be able to use it externally if the type
Indemnity_System.Client isn't public).

If you don't want to make the /class/ public, declare an interface with what
you need, and make the /interface/ public; then change the signature to
"public void Test (List<T> temp) where T : IClient" - this will allow any
list of items that support IClient

Marc
May 18 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.