ReadOnly property for getting the machine name of the computer.
The machine name of the computer the application is running on.
The information in the Environment.MachineName is dependent on the underlying operating system.
- On Linux, this returns the value of the HOSTNAME environment variable.
- On Windows, this returns the NETBIOS machine name of the computer.
Executing this program on a linux machine returns a name like "machinename.example.com", while on Windows, it'll show a name like "MACHINENAME".C# Example
using System; class SystemDemo { public static void Main(string[] args) { Console.WriteLine(Environment.MachineName); } }
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0