高手帮忙解决下。“SyncChatServer.User.client.get”必须声明主体,因为它未标记为 abstract 或 extern。谢谢
用于保存于客户通信需要的信息
源代码如下:
using System.Net.Sockets;
using System.IO;
namespace SyncChatServer
{
class User
{
public TcpClient client{get; private set;}
public BinaryReader br{get; private set;}
public BinaryWriter bw{get; private set;}
public string userName {get; set; }
public User(TcpClient client)
{
this.client = client;
NetworkStream networkStream = client.GetStream();
br = new BinaryReader(networkStream);
bw = new BinaryWriter(networkStream);
}
public void Close()
{
br.Close();
bw.Close();
client.Close();
}
}
}
------解决方案--------------------
private TcpClient client;
public TcpClient Client
{
get
{
return client;
}
set
{
client= value;
}
}
------解决方案--------------------
pruvate TCPClient client
public TCPClient Client
{
get{return client;}
set{client = value}
}
两个变量的名字不能相同