Get your local machine/computer name in c#

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”);

Published by

Simon Steed

Areas I specialise in include: · Acting as your IT Tsar, turning technical IT topics into plain and understandable English that you understand · IT Infrastructure covering network design, network management, server infrastructure, desktop maintenance etc · IT Management and Service Desk Management (aligned with ITIL) · IT Consultancy · IT Security · Software development processes · Dotnet Development (C#, Windows Forms and ASP.Net) · Agile Development methodologies · Project Management covering software applications through to building moves · Telecoms I'm also a passionate photographer now going professional so i'll be posting my pictures on here as well. Simon