Archive

Posts Tagged ‘System.Environment’

Get your local machine/computer name in c#

September 17th, 2008 Comments off

Four ways to get your local network/machine name:

string name = Environment.MachineName;
string name = System.Net.Dns.GetHostName();
string name = System.Windows.Forms.SystemInformation.ComputerName;
string name = System.Environment.GetEnvironmentVariable(“COMPUTERNAME”);