VB.NET的 "My" 與 C#的 "That"

VB.NET有"My"物件,那C#有沒有呢..答案是有的..叫"That"

VB.NET有"My"物件,那C#有沒有呢..答案是有的..叫"That"

VB.NET的MY物件其實也不過是重新包裝.Net Framework裏的其它物件,舉個例子,如下所示:
 

Dim str1 As String = My.Computer.FileSystem.ReadAllText(Server.MapPath("test.txt"))
Dim str2 As String = System.IO.File.ReadAllText(Server.MapPath("test.txt"))


以上兩個功能是一樣的..

C#其實有一個叫"That"的東東..可以參考這個網站說明(http://blogs.msdn.com/danielfe/archive/2005/06/14/429092.aspx)

string str1 = That.Computer.FileSystem.ReadAllText(Server.MapPath("test.txt"));
string str2 = System.IO.File.ReadAllText(Server.MapPath("test.txt"));

以上兩個功能也是都一樣的..所以vb.net有"My",C#有"That"了...還真好用呀...

下載"That"原始碼:   
http://www.idesign.net/idesign/DesktopDefault.aspx?tabindex=5&tabid=11
keyword:"My for C# 2.0"
 

參考網址:

http://blogs.msdn.com/danielfe/archive/2005/06/14/429092.aspx

http://www.purecs.net/thread/topic323_1.aspx