My Namespace

One of the new features introduced with Visual Basic 2005 is the My namespace.
Provides quick access to some of the most common features which are sometimes hard to find otherwise in the .NET Framework.
All the features in the My object namespace are available in the .NET framework class library.
It means that you might have to learn 2 different ways of accessing the same thing.
My namespace is aimed at making the common development tasks very easy to perform.
Be aware that using these shortcuts might not give you all the power or functionality that you would get by accessing them directly from the class library
Extremely VB centric and not really used by many C# developers.
Also with the My namespace, the code you write will be much easier to understand and maintain when a new developer looks at it for the first time.



Using My Objects

The My objects gives you quick access to application, system and user information without having to search through the .NET Framework libraries

My.Applicationapplication specific seetings
My.Application.Info.DirectoryPathSystem.Reflection.Assembly.GetExecutingAssembly
 System.Reflection.Assembly.Location
My.Application.Info.VersionSystem.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion
My.Computercomputer component, for example clipboard
My.ComputerName 
My.Computer.Clock.LocalTime 
My.Computer.ClipboardSystem.Windows.Forms.Clipboard
My.Computer.Clipboard.GetText 
My.Computer.Registry.GetValue 
My.Computer.Info.AvailablePhysicalMemory 
My.Computer.Info.TotalPhysicalMemory 
My.Computer.Info.OSFullName 
My.Computer.Info.OSPlatform 
My.Computer.Info.OSVersion 
My.Resourcesresources within your solution
My.Resources.Resources.MyResource 
My.Settings 
My.Settings.MysettingProperties.Settings.Default.Mysetting
My.Settings.Save 
My.Usercurrent user information
My.User.InitializeWithWindowsUser 
My.Forms 
My.WebServicesprovides an instance of very web service currently references in your solution.



© 2020 Better Solutions Limited. All Rights Reserved. © 2020 Better Solutions Limited TopPrevNext