C# - Finding my machine's local IP Address and not the VM's
<p>I have a VirtualBox VM installed on my machine and as such there is an ethernet adapter that appears for it. I'm enumerating through the list of my machine's IP address via the following:</p>

<pre><code>       public string GetLocalIpAddress()
       {
            try
            {
                string strHostName = Dns.GetHostName();

                // Then using host name, get the IP address list..
                IPHostEntry ipEntry = Dns.GetHostEntry(strHostName);

                foreach (IPAddress ip in ipEntry.AddressList)
                {
                    if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                    {
                        return string.Format("({0})", ip.ToString());
                    }
                }
            }
            catch(Exception e)
            {
                Global.ApplicationLog.AddApplicationLog(EnumAppEventTypes.SYSTEM_ERROR, e.ToString());
            }

            return "";
        }
</code></pre>

<p>My problem is that the virtual machine's ethernet adapter also catches on the condition:</p>

<pre><code>if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
</code></pre>

<p>Is there a way of picking out my machine's local ip address and disregarding my virtual machine's?</p>
