internal static InternalIPAddressCollection MarshalIpAddressCollection(IntPtr ptr) { InternalIPAddressCollection addressList = new InternalIPAddressCollection(); while (ptr != IntPtr.Zero) { IpAdapterAddress addressStructure = Marshal.PtrToStructure <IpAdapterAddress>(ptr); IPAddress address = addressStructure.address.MarshalIPAddress(); addressList.InternalAdd(address); ptr = addressStructure.next; } return(addressList); }
internal static IPAddressInformationCollection MarshalIpAddressInformationCollection(IntPtr ptr) { IPAddressInformationCollection addressList = new IPAddressInformationCollection(); while (ptr != IntPtr.Zero) { IpAdapterAddress addressStructure = Marshal.PtrToStructure <IpAdapterAddress>(ptr); IPAddress address = addressStructure.address.MarshalIPAddress(); addressList.InternalAdd(new SystemIPAddressInformation(address, addressStructure.flags)); ptr = addressStructure.next; } return(addressList); }