VB programmers have a pretty cool feature to wave in the faces of C# programmers in 2005 with the My feature… or do they? If you are not familiar with the My feature, it is a new keyword in VB2005 that you can type, and when you hit the . (dot) key, you will have instant access to a ton of common things such as the file system, user identity, network, and so on through some easy to use properties.
So VB has Me and My, why shouldn’t C# have this and That? My colleague Juval has implemented a That class that exposes all the capabilities of My from VB to C# developers. It uses the same syntax and approach as My, just type That. and navigate through the object heirarchy to find the features that you want.
All My (and That) do is give you shortcut access to the most common features that people code against. Ultimately, you can achieve the same thing by finding the appropriate class in the .NET framework and invoking its functionality. But My (and now That) make it a lot quicker and easier to code up common scenarios.
In case you are a hard core C# guy who thinks this is just a joke and are thinking that there is no point, consider if you find some VB 2005 code in a sample that does what you want, but they are making extensive use of the My feature. How do you port that code to C#? Without the That class, you will have to rewrite anything that is using My. With the That class, you can just migrate it directly with little to no syntax conversion. The same would be true if you were going to migrate a complex VB 2005 app to C#.
Obviously since That is kind of a play on words, and we provide you the source code, you could change That to My and have the same name for the class as in VB. But That kind of has a nice ring to it.
Hats off to Juval for throwing this together in the wee hours