rm that the address is updated. SaveAddress ( address, email ); void SaveAddress ( string address, string email ) { // Job 1. // Save the address. // ... // Job 2. // Send an email to inform the supervisor that the address is changed. // ... } 使用C# 或 VB.NET的特有类型,而不是System命名空间中定义的别名类型。 好: int age; string name; object contactInfo; 不好: Int16 age; String name; Object contactInfo; 别在程序中使用固定数值,用常量代替。 别用字符串常数。用资源文件。 避免使用很多成员变量。声明局部变量,并传递给方法。不要在方法间共享成员变量。如果在几个方法间共享一个成员变量,那就很难知道是哪个方法在什么时候修改了它的值。 必要时使用enum 。别用数字或字符串来指示离散值。 好: enum MailType { Html, PlainText, Attachment } vo页码:[1] [2] [3] [4] [5] [6] [7] [8] 第6页、共8页 |