扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:陶刚编译 来源:yesky 2007年11月13日
关键字:
public enum MessageType { RequestEmployee = 1, Employee, } |
public class RequestEmployee: ISocketObject { int id; public RequestEmployee(int id) { this.id = id; } } public RequestEmployee(BinaryReader reader) { id = reader.ReadInt32(); } public int ID { get { return id; } } public void Send(BinaryWriter writer) { writer.Write((int) MessageType.RequestEmployee); writer.Write(id); } } |
RequestEmployee requestEmployee = new RequestEmployee(15); requestEmployee.Send(writer); MessageType messageType = (MessageType) reader.ReadInt32(); switch (messageType) { case MessageType.Employee: Employee employee = new Employee(reader); Console.WriteLine("{0} = {1}", employee.Name, employee.Address); break; } |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。