相关文章  
  • 非常详细的 XLink1.0 学习笔记
  • 非windows操作系统与windows简易整合(2)
  • 非windows操作系统与windows简易整合(3)
  • Longhorn(长角)系统的初步优化
  • 彻底探索计算机变慢10大原因
  • 高级Windows 2000 Rootkit检测技术
  • 虚拟主机探虚实
  • “Windows优化大师”应用三忌
  • 20例Windows XP操作系统优化技巧
  • 高效的数据仓库管理设计以及所需注意事项
  •   推荐  
      科普之友首页   专利     科普      动物      植物        天文   考古   前沿科技
     您现在的位置在:  首页 >>文献 >>培训

    养成 C# 编码规范和编程的好习惯6

    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页

         

          设为首页       |       加入收藏       |       广告服务       |       友情链接       |       版权申明      

    Copyriht 2007 - 2008 ©  科普之友 All right reserved