public DnsResourceDataNamingAuthorityPointer(ushort order, ushort preference, DataSegment flags, DataSegment services, DataSegment regularExpression, DnsDomainName replacement) { if (flags == null) { throw new ArgumentNullException("flags"); } if (!IsLegalFlags(flags)) { throw new ArgumentException( string.Format(CultureInfo.InvariantCulture, "Flags ({0}) contain a non [a-zA-Z0-9] character.", Encoding.ASCII.GetString(flags.Buffer, flags.StartOffset, flags.Length)), "flags"); } Order = order; Preference = preference; Flags = flags.All(flag => flag <'a' || flag> 'z') && flags.IsStrictOrdered() ? flags : new DataSegment(flags.Select(flag => flag >= 'a' && flag <= 'z' ? (byte)(flag + 'A' - 'a') : flag) .Distinct().OrderBy(flag => flag).ToArray()); Services = services; RegularExpression = regularExpression; Replacement = replacement; }