using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;//聊天用户类public class ChatUser{ private string _Name;//账号 private string _Password;//密码 private DateTime lastUpdated;//上次更新时间 public ChatUser(string name, string password) { this._Name = name; this._Password = password; this.lastUpdated = DateTime.Now; } public string Name//账号 { get { return this._Name; } } public string Password//密码 { get { return this._Password; } } public bool IsExpired(TimeSpan timeSpan)//用户登录是否过期 { return DateTime.Now - this.lastUpdated >= timeSpan; } public void Update()//更新自己的过期时间 { this.lastUpdated = DateTime.Now; }}

评论