Frans Bouma said:
Isn't 'My' in the framework btw? Or is it a native VB.NET keyword? I
haven't
checked, but it wouldn't surprise me if it was a class which can be
referenced from C# as well...
My is a combination of a namespace within Microsoft.VisualBasic.dll and some
code generated by the vb compiler.
The vb compiler\IDE(not sure of which at this point) generates a set of
partial classes in the my namespace, MySettings, MyResources, MyForms(IIRC,
anyway), which provide convient functinoality via a standard My. interface.
There may also be some compiler based aggregation that allows My. to have
some functionality the compiler divines instead of coming from code
generated by the IDE or written by the user. I am, obviously, not a VB
master, lol. This might be something worth posting to the vb group, however.
I'm sure one of the VB MVP's knows quite precisely how My works.
Because of this, My's functionality isn't *entirely* available in other
languages, but much of it should be via Microsoft.VisualBasic.dll and the
IDE itself. For example, in whidbey, VC# generates a Settings.cs file using
the new SettingsBase functionality in the framework when you add a setting
in a projects properties. I think it does something similar for resources,
etc.
My in and of itself is not something I would personally like to see in C#.
It just isn't a feature I consider to be particularly valuable to my work,
appropriate within the C# philosophy, and I do worry that it will start to
drive the quality of developer down as he trys to fit everything into the
"My" mold, instead of the framework itself.
I hope VB doesn't have an issue with it, because I do think its a wonderful
feature insofar as the classic VB mindset goes. I suspect it will go easier
for VB devs than it would for C#\C++ ones, at that. Any VB dev who used VB6
or earlier should, by this point, be quite able to recognize the limitations
of the langauge's features and know when its time to step out into the
framework(or even other languages).
I suspect many C# devs would either shun the namespace entirely or not be as
able to stop using it as they would need to be, simply out of lack of
experiance.