internal static Dns GetAndInitializeDns(Server server) { Dns dns = new Dns(); dns.Options = Provider.GetDnsOptions(server.ExternalDNSProtocolOption); MultiValuedProperty <IPAddress> externalDNSServers = server.ExternalDNSServers; if (server.ExternalDNSAdapterEnabled || MultiValuedPropertyBase.IsNullOrEmpty(externalDNSServers)) { dns.AdapterServerList(server.ExternalDNSAdapterGuid); } else { IPAddress[] array = new IPAddress[externalDNSServers.Count]; externalDNSServers.CopyTo(array, 0); dns.ServerList.Initialize(array); } return(dns); }