2008年1月18日星期五

學習C# 3.0的好網推薦

這幾天都學習C# 3.0的新功能,主要都是ADO.NET Entity Framework,LINQ和 Extension methods,
一路玩LINQ,就一路有疑問,就是何時應該使用LINQ。看過很多Example , 都是先建立一個Class,去把TableColumn先做Mapping,再由DataContext去把Table實體化。

之後很多都會直接做DataSource 或者轉做 Anonymous types,但是我昨天就試過把LINQ的Table轉回至DataTable,最後都不知怎樣做,上Google Search找回來的竟然是使用Foreach去讀出Anonymous types,再填入Datarow再加進DataTable....
完成後的Code比傳統使用ADO.NET更長更複雜....我覺得如純粹做Data-Mining,使用LINQ有點冗長。

但相反,由DataSet 中,使用LINQ把資料讀出就比較直接先進.

最後到Extension methods ,十分好用而且簡單,可以看看:
Using the New Extension Methods Feature in C# 3.0
http://www.developer.com/net/csharp/article.php/3592216
C#之 VS2008 之 Extension Methods
http://www.cnblogs.com/hanxianlong/archive/2007/11/06/951446.html
C# 3.0 feature 2--Extension methods
http://www.cnblogs.com/hiber/archive/2007/04/29/725617.html

清理Bookmark 時看到這幾個網頁,我覺得是寫得不錯的,都不是新文章,都是C# 2.0的東西.

Iterator :
http://www.cnblogs.com/JimmyZhang/archive/2007/08/22/865245.html

.NET Framework 2.0 中的Generic Class :
(如你還在使用ArrayList,要看看box和unbox對效能的影響)
http://www.cnblogs.com/JimmyZhang/archive/2007/08/04/842663.html

Delegate & Event :
http://www.blueidea.com/tech/program/2007/4959.asp

C# 2.0中的Nullable Type
http://dotnetframework.blogspot.com/2006/08/c-20nullable-type.html

1 則留言:

  1. Hey, you need not to create a class by yourself ga...

    If you are using SQL Server, you can add a "LINQ TO SQL Classes" Drag and drop the table from server connection jar...

    and thanks your information.

    回覆刪除