Write a C# methods to get information about your Local IP address, Type of NIC and Host Name? Write the basic statements in C# which uses to do that? code example
Example: c# get pc ip address
public static string GetLocalIPAddress()
{
var host = Dns.GetHostEntry(Dns.GetHostName());
foreach (var ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
return ip.ToString();
}
}
throw new Exception("No network adapters with an IPv4 address in the system!");
}