例如,要获取本地IP地址,我使用以下命令:
string myHost = System.Net.Dns.GetHostName();
string myIP = System.Net.Dns.GetHostEntry(myHost).AddressList[0].ToString();