Xamarin.Android 获取手机IP地址
命名空间:
using System.Net;
代码:
IPAddress[] address = Dns.GetHostAddresses(Dns.GetHostName()); if (address != null && address[0] != null) { string IP = address[0].ToString(); }
命名空间:
using System.Net;
代码:
IPAddress[] address = Dns.GetHostAddresses(Dns.GetHostName()); if (address != null && address[0] != null) { string IP = address[0].ToString(); }