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

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

    r.
       }
      
      
      不好:
       // This method will save the phone number.
       void SaveData ( string phoneNumber )
       {
       // Save the phone number.
       }
      
      一个方法只完成一个任务。不要把多个任务组合到一个方法中,即使那些任务非常小。
      
      好:
       // Save the address.
       SaveAddress ( address );
      
       // Send an email to the supervisor to inform that the address is updated.
       SendEmail ( address, email ); 
      
       void SaveAddress ( string address )
       {
       // Save the address.
       // ...
       }
      
       void SendEmail ( string address, string email )
       {
       // Send an email to inform the supervisor that the address is changed.
       // ...
       }
      
      
      不好:
       // Save address and send an email to the supervisor to info

    页码:[1] [2] [3] [4] [5] [6] [7] [8]5页、共8页

         

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

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