Jesse Liberty has written a very nice article on My for O’Reilly’s OnDotnet.com. He starts with a theme we’ve seen a lot of over the years:
For a couple of years now, I’ve been touting the Microsoft-endorsed sentiment that it really doesn’t matter if you program in C# or in VB.NET, since both are just syntactic sugar layered on top of MSIL (Microsoft Intermediate Language, the true language of .NET).
But then adds:
That appears to be changing a bit with Whidbey.
He then talks about some of the features you’ll get with My. He concludes with:
Myobject has made creating this application almost absurdly easy. […] VB 2 has taken a dramatic lead in Rapid Application Development with the
Go check it out!
Does this mean in MS’ eyes that VB and C# are diverging, on purpose?
Is it possible for third parties to extend My object? If so, could you please mention the relevant attributes/interfaces/etc.? Thanks.
Mike, your question is kind of covered at: http://panopticoncentral.net/archive/2004/04/23/991.aspx.
Elton: We’re working on a whitepaper that covers exactly this. Until that becomes available, you can check out http://dotnetd2d.com/Content/Tip_viewitem_03NoAuth.aspx?id=32b61703-99a1-42d4-b7ad-f1e9f3d5809c§ion=dotNet.
Thanks Paul. I look forward to the whitepaper.
I found it was very easy to extend ‘My’. Partial class can be used to add new properties to My.Application and My.Computer. With the help of ‘HideModuleNameAttribute’ we can add any other shortcuts to the My namespace directly.
>> Extending the "My" Object
I know it is technically possible, but if you publish how to do it please, please do so in a way that doesn’t create a tower of babble of incompatible extensions.
I almost think you’d need to have an psuedo open source project that someone from MS managed and the purpose was to extend My by adding provider specifications.
For example, you could add document imaging as an extension, but the "correct " way to do it would be for a third party to provide an provider that plugs into the My object so developers could use a standardized interface for document imaging when going thry the My object.
I’m sure there are other maybe even better ways, and I would love to hear them if there are.
I found that even class library projects have a My namespace. I don’t think it is a good idea. Class library is used to export custom classes to other applications, so we don’t want unexpect namespaces be added to our project. I think this is a big problem that must be fixed in the future releases of Visual Basic 2005.
Fan: The namespaces are entirely encapsulated in your project (i.e. all the types are Friend, none of them Public). Are there specific concerns you have about producing just Friend classes?
To Paul Vick :
Thanks. But an empty ‘My’ namespace will appear in the object browser. It makes my class library a little bit "unprofessional".
Could you please make My namespaces optional? For example an "Option My" statement(just a suggestion<g>). So that we can completely close generating a My namespace for the project in some cases. It will be more reasonable. Athough I know that My.Application is a new object model for Windows Forms project and hard to be turned off… At least allow us do this in class library projects, please.
Extending the "My" Classes in VB 2005 … Just Say NO!
Nice words, thank you so much for them. Good for you! take care!