C# 获得本机IP

System.Net.IPAddress[] ips = System.Net.Dns.GetHostAddresses(Environment.MachineName);
string strIP = "";
for(int i=0;i<ips.Length;i++)
{
    strIP += ips[i].ToString();
}
this.TextBox1.Text = strIP;
原文地址:https://www.cnblogs.com/freeliver54/p/1219306.html