Difference between Environment.MachineName, SystemInformation.ComputerName
and Dns.GetHostName

 Posted by Ddd on 2/14/2011 | Category: .NET Framework Interview questions | Views: 135110 | Points: 40

Environment.MachineName :

Environment is a class defined by System Namespace.
MachineName is its property.

It reads the NetBIOS name of local computer..

SystemInformation.ComputerName :

SystemInformation is a class defined by System.Windows.Forms Namespace
ComputerName is its property,

Same as Environment.MachineName

Dns.GetHostName :

Dns is a class defined by System.Net namespace:
GetHostName is its method.

It gets host name of computer which refers to a domain name that has one or more associated IP adresses.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response