我正在学习构建聊天客户端和服务器的教程,现在我遇到了以下错误:
Inconsistent accessibility: field type 'System.Collections.Concurrent.ConcurrentDictionary<string,ChattingServer.ConnectedClient>' is less accessible than field 'ChattingServer.ChattingService._connectedClients' c:\Users\KOEMXE\Documents\Visual Studio 2012\Projects\ChatApplication\ChattingServer\ChattingService.cs 17 62 ChattingServer
Run Code Online (Sandbox Code Playgroud)
这是相关问题所在的类文件 (ChattingService.cs):
using ChattingInterfaces;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
namespace ChattingServer
{
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple, InstanceContextMode = InstanceContextMode.Single)]
public class ChattingService : IChattingService
{
//private ConnectedClient _connectedClients;
public ConcurrentDictionary<string, ConnectedClient> _connectedClients = new ConcurrentDictionary<string, ConnectedClient>();
public int Login(string userName)
{
//is anyone else logged in with my name?
foreach (var client in _connectedClients) …Run Code Online (Sandbox Code Playgroud)