public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append(escape(name)).Append('.').Append(type.toDnsString()).Append('.').Append(domain); foreach (String subtype in type.getSubtypes()) { sb.Append(',').Append(subtype); } return(sb.ToString()); }
/** * Get all service names of a service type in a single domain. * If the specified type has subtypes then only instances registered under any of those are returned. * @param type the service type. * @param domainName the domain to browse. * @return a list of service names. */ private List <ServiceName> getServiceInstances(ServiceType type, DomainName domainName) { if (type.getSubtypes().Count <= 0) { List <ServiceName> results = new List <ServiceName>(); getServiceInstances(type.toDnsString(), domainName, results); return(results); } else { HashSet <ServiceName> results = new HashSet <ServiceName>(); foreach (String subtype in type.toDnsStringsWithSubtype()) { getServiceInstances(subtype, domainName, results); } return(new List <ServiceName>(results)); } }