[c#] local ip 찾는 함수

private string GetLocalIP()
{
string myIP = string.Empty;
IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName());
foreach (var ip in host.AddressList)
{
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
{
myIP = ip.ToString();
return myIP;
}
}
return myIP;
}