user.cs
来自「ICE3.3.0--聊天程序服务器端demo」· CS 代码 · 共 76 行
CS
76 行
// **********************************************************************
//
// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
//
// This copy of Chat Demo is licensed to you under the terms
// described in the CHAT_DEMO_LICENSE file included in this// distribution.
//
// **********************************************************************
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace ChatDemoGUI
{
// This class models the users of a chat room.
class User
{
public User(string name)
{
_name = name;
}
public string Name
{
get
{
return _name;
}
set
{
_name = value;
}
}
public override int GetHashCode()
{
return -1; // Not needed
}
public override bool Equals(object obj)
{
if(obj == null)
{
return false;
}
if(this.GetType() != obj.GetType())
{
return false;
}
User user = (User)obj;
return user.Name == Name;
}
private string _name;
}
//
// Extends ObservableCollection to store the list of chat users.
//
// We need use ObservableCollection so the view is updated when the list contents change.
//
// Also note that updates to the list need to be done from the UI thread
// for ObservableCollection to work correctly.
//
class UserList : ObservableCollection<User>
{
public UserList()
{
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?