How to Get HostName in C#/CSharp

How to Get HostName in C#/CSharp
Rating: 5 - 1 Votes

How to Get HostName in C#/CSharp

To get host name of the local computer, we make use of GetHostName() method which resides in Dns class.  Dns class is part of System.Net space.  Example is given below.