private IEnumerable <UnicastIPAddressInformation> Filter(UnicastIPAddressInformationCollection unicastAddresses, GatewayIPAddressInformationCollection gatewayAddresses) { foreach (var ip in unicastAddresses.Where(ip => ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)) { foreach (var g in gatewayAddresses.Where(g => g.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)) { if (Test(ip.Address, g.Address, ip.IPv4Mask)) { yield return(ip); } } } }