VB.Net - My

Introduced in Visual Basic 2005.
The My feature provides easy and intuitive access to a number of .NET Framework classes, enabling the Visual Basic user to interact with the computer, application, settings, resources, and so on.
link - learn.microsoft.com/en-us/archive/msdn-magazine/2006/vs-2005-guided-tour/visual-basic-using-my-namespace-to-navigate-projects-and-net


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.FileSystem.SpecialDirectories.Desktop 
My.Computer.FileSystem.WriteAllText 
My.Computer.FileSystem.ReadAllText 
My.Computer.FileSystem.Drivesan enumeration of available drives
My.Computer.FileSystem.DirectoryExistschecks the presence of a directory
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.



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