Using the My Feature in Visual Basic .NET
Long time no write, kids. Sometimes life throws you a curve, you get whacked, and you take a base. Standing on first a little dazed and confused, it’s good to be writing about something simple and fun: the My feature.
Microsoft Visual Basic developers did something that most of you have been doing for years: They wrapped up some more-complex stuff in a wrapper, mixed in the relatively new meaning of the Shared keyword, and made a bunch of everyday stuff easier to get at. The biggest difference is that you don’t have to do the work in this instance.
Very simply, My is a feature in .NET—used mostly by VB programmers—that condenses namespaces and classes into easier-to-use shared behaviors. My includes a plethora of everyday programming capabilities (including access to the registry, clipboard, writing to the event log, file I/O, and moving files across a network) that I’ll show you how to use.
The code in this article is not intended to show you how clever I am, but rather how easy My is. I do have one gentle word of caution: Like cane sugar, too much "My sugar" can become an excuse to avoid grown-up foods for a little longer. Don’t let tools used to make life a little easier become an opportunity to become complacent about mastering OOP.