Environment.MachineName
and System.Windows.Forms.SystemInformation.ComputerName
are identical and returns the computer's NetBIOS name. This name is restricted to 15 characters and only visible on the LAN.
System.Net.Dns.GetHostName()
returns the computer's TCP/IP based hostname. By adding a domain suffix to the hostname you can resolve your computer's IP address across LANs / on the internet.
System.Environment.GetEnvironmentVariable("COMPUTERNAME")
returns the computer name set during installation. NetBIOS and hostname are initially set to the same name.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…