Effective C# 第五章:和Framework一起工作(譯)

來源:互聯網
上載者:User

Effective C# 第五章:和Framework一起工作
Chapter 5. Working with the Framework

我的同事,也是我的朋友Martin Shoemaker研究一個很嚴肅的問題,那就是:“我必須寫這樣的.Net代碼嗎?” 答案是,也希望是:不。你應該使用你手頭上有的,也是你會用的工具來協助你寫代碼。

.Net架構是一個很豐富的類庫,你對架構學習的越多,你自己要寫的代碼就越少。架構庫會幫你完成很多工作。這一章就告訴你一些.Net架構裡最常用的一些技術。當你在.Net架構中有多個選擇時,這一章中的一些原則會協助你選擇最好的。你可以使用一些已經存在的東西來寫你自己的類和演算法,而不應該是與它們相抵觸。

這一章中的一些原則反映一些演算法和類,當一些開發人員可以輕鬆的使用.Net架構的時候,這是他們決心要自己寫的。他們之所以要自己寫這些,這是因為,有些時候,.Net架構確實不清楚他們想要什麼。這時,我會告訴你如何來擴充已經存在的核心功能。還有一些時候,因為他們不清楚核心時如何工作的;也有時候是因為他們對效能有過高的要求。

即使是使用.架構裡所有可用的工具,也有很多的開發人員寧可建立他們自己的工具。千萬別寫這些代碼,特別是已經有人完成了的。
=================
   

Chapter 5. Working with the Framework
My friend and colleague Martin Shoemaker runs a great roundtable called "Do I Have to Write That .NET Code?" The answer is, hopefully, no. You should use all the tools at your disposal to avoid writing code that already exists and that you can use.

The .NET Framework is a rich class library. The more you learn about the framework, the less code you need to write yourself. The framework library will do more of the work for you. This chapter shows you some common techniques to get the most out of the .NET Framework. Other items help you choose the best option when multiple choices are available in the framework. You can write your classes and algorithms to utilize what's already there instead of fighting against it. The items in this chapter reflect the algorithms and classes that developers seem intent on building for themselves when they could easily use the .NET Framework. Sometimes it's because the framework isn't exactly what you need. In those cases, I show you how to extend the core functionality. Sometimes, it's because they don't understand how the core works. Sometimes, it's because they are overly concerned with performance.

Even with all the tools available in the framework, too many developers would rather create their own wheels. Don't write that codeespecially if someone else already did.

 
   

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.