|
C#聊天程序(10) writer = null; statusText = prevSendText = prevReceiveText = String.Empty; } // Finalize a talker ~Talker(){ Dispose(); } // Dispose of resources and surpress finalization public void Dispose(){ GC.SuppressFinalize(this); if(reader != null){ reader.Close(); reader = null; } if(writer != null){ writer.Close(); writer = null; } if(socket != null){ socket.Close(); socket = null; } } // Nested delegat class and matchine event public delegate void NotificationCallback(Notification notify, Object data); public event NotificationCallback Notifications; // Nested enum for notifications public enum Notification{ Initialized = 1, StatusChange,
|