可访问性不一致的错误C# [英] Inconsistent accessibility error C#

查看:119
本文介绍了可访问性不一致的错误C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个错误与列表的属性。它说该列表是不是属性不易进入的。我不知道为什么我收到此错误。

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.

推荐答案

最有可能的客户端不是一个公共类和 ClientListAccessor ​​是公开访问。来电者将有机会获得财产,但不知道它返回的类型。

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.

这篇关于可访问性不一致的错误C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆