Lunch breaks always tend to end up being cut short by stupid ideas, today by my insistence to use My (from Visual Basic) in C#. To get up to speed on My, I suggest looking at Development with My in the MSDN library. The class diagram graphic will come in handy later on.
Step 1 is to reference the Microsoft.VisualBasic.dll assembly:
Next, we need a couple of includes:
using Microsoft.VisualBasic.ApplicationServices;using Microsoft.VisualBasic.CompilerServices;using Microsoft.VisualBasic.Devices;using Microsoft.VisualBasic.FileIO;using Microsoft.VisualBasic.Logging;
Why those and not Microsoft.VisualBasic.MyServices? Well, My is just an amalgamation of various classes that live in those namespaces: Computer, Audio, ... All the stuff you saw in the class diagram in the article Development with My.
Basically, you now have the functionality provided by My, but not as nicely grouped with a My object as in Visual Basic. To achieve this, have a look at the article C# My Services by Gildeoni Santos, it sports a download for wrapping My. As the code (at the time of this writing) is based on Beta 1 bits, you will have to put in the correct namespace references and pull the My prefix on all class names.