Remove duplicates property from objects list
<p>i have an List of objects.
my object is <code>NetworkAdapter</code> that represent the Network Card on my machine.
this Network Card has the property ID for example: <code>{1106B232-363f-417F-9DC9-643BB02BEDE2}</code>
and of course Ip Address, name etc.
my problem is that if i case the Network Card has more than 1 Ip Address so my application shows that same Network Card twice (each time with the different ip) but because this is the same nerwork card so the ID is the same so what i want to do is to take this <code>List&lt;NetworkAdapter&gt;</code> and remove the duplicate Network Card with the same ID.</p>

<p>this is my function that get all the adapter on the machine:</p>

<pre><code>public static NetworkAdapter[] GetAll()
{
    List&lt;NetworkAdapter&gt; list = new List&lt;NetworkAdapter&gt;();
    foreach (NetworkInterface adapter in NetworkInterface.GetAllNetworkInterfaces())
        foreach (UnicastIPAddressInformation uniCast in adapter.GetIPProperties().UnicastAddresses)
        {
            if (!System.Net.IPAddress.IsLoopback(uniCast.Address) &amp;&amp; uniCast.Address.AddressFamily != AddressFamily.InterNetworkV6)
            {
                StringBuilder gatewayIPAddresses = new StringBuilder();
                string gatewayIPAddressesDisplay = string.Empty;
                foreach (var address in adapter.GetIPProperties().GatewayAddresses)
                {
                    gatewayIPAddresses.Append(address.Address);
                    gatewayIPAddresses.Append(" ");
                }

                if (gatewayIPAddresses.Length &gt; 0)
                {
                    gatewayIPAddressesDisplay = gatewayIPAddresses.ToString().TrimEnd(' ');
                }

                list.Add(new NetworkAdapter(getDevice(adapter.Id))
                {
                    Name = adapter.Name,
                    ID = adapter.Id,
                    Description = adapter.Description,
                    IPAddress = uniCast.Address.ToString(),
                    NetworkInterfaceType = adapter.NetworkInterfaceType.ToString(),
                    Speed = adapter.Speed.ToString("#,##0"),
                    MacAddress = getMacAddress(adapter.GetPhysicalAddress().ToString()),
                    gatewayIpAddress = gatewayIPAddressesDisplay
                });
            }
        }

    return list.ToArray();
}
</code></pre>

<p>what is the best way to do it ?</p>
