Reputation: 1036
I'm getting an error with a property for a list. It's saying the list is less accessible than the property.. I'm not sure why I am getting this error..
//List
private List<Client> clientList = new List<Client>();
//Property
public List<Client> ClientListAccessor
{
get
{
return clientList;
}
set
{
clientList = value;
}
}
Thanks in advance for any help.
Upvotes: 8
Views: 12948
Reputation: 26446
Most probably Client
is not a public class, and ClientListAccessor
is publically accessible. The caller will have access to the property but wouldn't know the type it returns.
Upvotes: 16
Reputation: 174329
That's happening, because the class Client
is not defined as a public
class. Make sure, the class definition looks like this:
public class Client
{
// ...
}
In your code it probably looks like this:
class Client
{
// ...
}
or like this (which is the same):
internal class Client
{
// ...
}
Upvotes: 6