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.Application | application specific seetings |
My.Application.Info.DirectoryPath | System.Reflection.Assembly.GetExecutingAssembly |
System.Reflection.Assembly.Location | |
My.Application.Info.Version | System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion |
My.Computer | computer component, for example clipboard |
My.ComputerName | |
My.Computer.Clock.LocalTime | |
My.Computer.Clipboard | System.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.Resources | resources within your solution |
My.Resources.Resources.MyResource | |
My.Settings | |
My.Settings.Mysetting | Properties.Settings.Default.Mysetting |
My.Settings.Save | |
My.User | current user information |
My.User.InitializeWithWindowsUser | |
My.Forms | |
My.WebServices | provides an instance of very web service currently references in your solution. |
© 2023 Better Solutions Limited. All Rights Reserved. © 2023 Better Solutions Limited TopPrevNext