C# Gets “My”, Well Sort Of

If you have read my previous blog about the My namespace in Visual Basic you understand how much I like this.  Well it seems so do C# developers.  Juval Lowy has been busy creating a “That” class in C# that wraps up and exposes the My functionality (with limits) in C#.

Check out the iDesign site:

“The My class in VB often simplifies and streamlines many operations, from Network programming to clipboard, to audio access, and so on. What takes sometimes a programming fit in C# can be done in one line using the My class in VB. If VB has Me and My, then C# should have this and That. The That class is the C# equivalent of the VB My class. It is a static class that uses the VB implementation as much as possible, and it requires adding a referencing to Microsoft.VisualBasic. The That class is instrumental when working in heterogeneous environments and when dealing with in porting of VB to C# or visa-versa.”

My favorite line "What takes sometimes a programming fit in C# can be done in one line using the My class in VB."  Then again that is just my VB colors showing.

I think this is a great example of the fact that VB and C# aren’t mortal enemies as some people would make them appear to be, they are different products targeting different groups of developers.  Good ideas flow both ways, innovation is alive and well in the Visual Basic world and the C# world.  Both languages have a bright future ahead.

Comments (9)

  1. Travis Owens says:

    COnsidering I have mixed feelings about VB’s My classes (great for new programmers, bad for sane code) I can say I’m mostly unhappy about any time of built in aliasing classes in C#.

    While I can’t deny the simplicity in both learning and possible reading something like That.File.Open("file.txt") I also don’t like the idea of having to be aware of the pointers to the same framework,

  2. Domenic Albano says:

    I’m not sure why this is necessary.

    Can’t you just reference the Microsoft.VisualBasic.dll from C#?

    Since it ships with dotnetfx anyway, it’s guaranteed to always be there. Use it!

    Am I missing something?

  3. As mentioned by Julie Lerman, Brad McCabe, and others, Juval Lowy is creating a “That” class in C# that…

  4. Adam Young says:

    Interesting… the reason My is in VB and not C# is because VB was always a "RAD" language, positioned for use by less-savvy programmers and even end-users; the RAD aspect was lost with .net 1.x (hence why so many VB.old programmers are now up in arms about VB.net & want VB.com added to VS.net…) – MS are now bringing the RAD back to VS, with Edit & Continue, My, and all the rest.

    It’ll be very useful for devs new to .net, and save them learning vast tracts of the framework; unfortunately, it’ll also be a crutch that will be very hard to give up – once you start using My, what’s the point of learning the framework equivalents?

    I think "That" is an amusing curiosity, but I won’t be using it.

  5. I blogged about this earlier, but there’s lots of discussion in the comments on whether this is a good or bad thing:


  6. Charles H Greene says:


    It is good to see that Microsoft employs at least one person with a VB background, who apparently is a US citizen and does not reside in India.

    When I read the second book on .Net I realized that every-one was more interested in using vague terminology, than actually trying to explain something. The author actually apologized for MS developing a Help system for VB Net that is confusing at best (C++ guys should stay in the back room, preferably in a cage). What a mess!

    I have a vary large, sophisticated VB6 application in production at several companies. If MS cans the bullsh_t and gets back to the spirit and intent of VB instead of C++, I would convert to .Net. Otherwise I will be converting it to Java. Hopefully VB 2005 is a step backward and forward!

    PS: Will the V2 of Net offer locking with ADO? Some of us work with applications that do not serve the top 50 corporations and require record locking!

  7. Joe Chung says:

    Why call it That instead of My? The possessive of Me is My, but the possessive of This is not That.

Skip to main content