VB’s "My" for C# Developers

Dan Fernandez has resulted very interesting example of use That in C# 2.0.

As you know for this purpose in VB already there is keyword My.

Using "My", you can write code like this:

Dim contents As String
contents = My.Computer.FileSystem.ReadAllText("c:\mytextfile.txt")

Instead of this


Dim contents As String
contents = IO.File.ReadAllText("c:\mytextfile.txt")

Many developers requested similar functionality for C#.

Juval Lowy realized static class That with functionality similar to My in VB.NET.


Leave a Reply