From what I have seen, in the MSDN documentation and in other questions here on SO, there are four ways to get the local machine name.
Environment.MachineName;
System.Net.Dns.GetHostName();
System.Windows.Forms.SystemInformation.ComputerName;
System.Environment.GetEnvironmentVariable("COMPUTERNAME");
Is there a differnece in what they methods will return or will they all return the exact same thing all of the time?
Note: I first saw the list in this post: How do I get the local machine Name?
See Question&Answers more detail:os