Faves:2009/03/14:C# 3.0 & IE8 web slice
c# 3.0
匿名類型是個很方便的語言特性,允許開發人員在代碼內簡明地定義行內CLR類型,而不用提供一個正式的類定義聲明。雖然它們可以在很多場合下使用,但在使用LINQ查詢和轉換/構形數據時尤其有用。
C# 3.0
#var這個關鍵詞而是告訴編譯器在變量最先聲明時,從用來初始化變量的表達式推斷出變量的類型。
var product = new { FirstName = "Scott", LastName = "Guthrie", Age = 32 };
Console.WriteLine(product.FirstName);
C# 3.0
#在C#裡,一個lambda表達式在句法上是寫成一個參數列表,隨後是 => 符號,隨後是表達式在調用時要運算的表達式或者語句塊
Console.WriteLine("AVG={0}", people.Average(p => p.Age));
IEnumerable
C# 3.0
#擴展方法允許開發人員往一個現有的CLR類型的公開契約(contract)中添加新的方法,而不用生成子類或者重新編譯原來的類型。擴展方法有助於把今天動態語言中流行的對duck typing的支持之靈活性,與強類型語言之性能和編譯時驗證融合起來。
public static class ScottGuExtensions
{
public static bool IsValidEmailAddress(this string s)
{
Regex regex = new Regex(@"^[w-.]+@([w-]+.)+[w-]{2,4}$");
return regex.IsMatch(s);
}
}
C# 3.0
Language-Integrated Query
*每個查詢表達式的句法從from子句開始,以select或group子句結束。from子句表示你要查詢什麼數據。select子句則表示你要返回什麼數據,且應該以什麼構形返回。
*在一個查詢句法表達式開頭的"from" 子句和結尾的"select"子句之間,你可以使用最常見的LINQ查詢運算符來過濾和轉換你在查詢的數據。兩個最常用的子句是"where"和"orderby"。這兩個子句處理對結果集的過濾和排序。
#用投影(Projection)來轉換數據
#理解延遲執行(Deferred Execution)和使用ToList() 和ToArray()
C# 3.0 的特色
新的C#語言特性:自動屬性(Automatic Properties)
public class Person {
public string FirstName { get; set; }
public string LastName { get; set; }
public int Age { get; set; }
}
C#和VB語言的新特性:對象初始化器(Object Initializers)
Person person = new Person { FirstName="Scott", LastName="Guthrie", Age=32 };
C#和VB語言的新特性:集合初始化器(Collection Initializers)
List
new Person { FirstName = "Scott", LastName = "Guthrie", Age = 32 },
new Person { FirstName = "Bill", LastName = "Gates", Age = 50 },
new Person { FirstName = "Susanne", LastName = "Guthrie", Age = 32 }
};
Web Slices
This section offers conceptual overview material for Web Slices, introduced with Windows Internet Explorer 8. A Web Slice uses simple HTML markup to represent a clipping of a Web page, enabling users to subscribe to content directly within a Web page.
#Subscribing to Content with Web Slices
#Web Slice Format Specification – Version 0.9
#Web Slice Icon Guidelines
其實 web slice 超級阿呆, 只要把某段 html code, 以微軟設定的 div class 包起來, 就算結束了
Web Slice 允許使用者訂閱某一個網頁中的特定區段,一旦訂閱後,該區段便會出現在 Internet Explorer 8 的工具列上,使用者可以直接點擊該按紐查看該區段的內容,更好的是該區段會自動連往原始網頁進行更新。
其它
: Matt Berseth寫了一篇很好的文章,示範如何添加一些非常酷的CSS和AJAX效果來改進ASP.NET GridView控件的可讀性。
十字加亮
在ASP.NET 2.0中發送郵件:答覆地址,發送優先設置和要求閱讀收據的問題: Scott Mitchell寫了一篇非常有用的文章,描述如何使用.NET 2.0和ASP.NET 2.0中的一些高級的email特性。
Dim mm As New MailMessage(fromAddress, toAddress)
mm.Subject = subject
mm.Body = body
mm.ReplyTo = New MailAddress("答覆地址")
mm.Priority = MailPriority.High ‘ 優先
mm.Headers.Add("Disposition-Notification-To", "回條地址")
This video series includes over six hours of video-based instruction that walks you through creating and deploying your first web page, to creating a fully-functioning …
給 ASP.NET 2.0 初學者的線上教學影片
* Consuming feeds.
* Support for generation of feeds in ASP.NET application
* Set of classes for programmatic consumption and generation of RSS feed in a late-bound way, without using strongly types generated classes
在.NET3.5後有ServiceModel.Syndication可以快速處理RSS但還是麻煩阿…最近因為ASP.NET MVC的關係常晃Scott Guthrie’s的Blog意外看到了這個好東西,非常簡單的讓你使用別人的RSS以及創建自己的RSS。
http://aspnetresources.com/downloads/ms_ajax_library_cheat_sheets1.zip
適用於 .NET Framework 3.5 SP1 的 ASP.NET 和 Windows Form 圖表控制項
2007/6/4微軟購買了 Dundas 公司所有的 Dundas Data Visualization 元件版權。後來公佈了 Microsoft Chart Controls for Microsoft .NET Framework 3.5 (http://tinyurl.com/amkh94) 控制項元件,可以同時支援在 ASP.NET 與 Windows Form 環境開發圖表相關的客製化應用程式,而這一套控制項的核心正是微軟跟 Dundas 公司購買的那些 Dundas Data Visualization 元件。
Microsoft .NET Framework 3.5 SP1
延伸閱讀:http://tinyurl.com/d6datb , http://tinyurl.com/df69gn ,
@For /f "tokens=1-3 delims=/ " %%a in (‘date /t’) do (set date=%%a-%%b-%%c)
指令"date /t"輸出"2009/03/13 星期五"
@echo The date is %date% 輸出2009-03-13
@For /f "tokens=2-3 delims=: " %%a in (‘time /t’) do (set time=%%a:%%b)
指令"time /t"輸出"上午 12:14"
@echo The time is %time% 輸出12:13
@IF NOT EXIST %date% mkdir %date%
如果該目錄不存在就建立
@set dailylog=%date%.log
@IF NOT EXIST %date%/%dailylog% echo ### > %date%/%dailylog%
如果檔案不存在就建立
[找出瓶頸]
1.Firefox web-developer toolbar(http://tinyurl.com/p336d)
2.Firebug Plugin(http://tinyurl.com/ehh7l)
3.OctaGate SiteTimer(http://tinyurl.com/ydzryc)
[壓縮程式碼]
1.JSLint(http://tinyurl.com/y8guls)分析
2.Rhino(http://tinyurl.com/dfa3ub)壓縮
[將程式碼放在後面]
[動態載入JS檔]
[用timer延遲執行]
[快取]
[整合成一個JS檔]