Exemple #1
0
        /// <summary>
        /// Encodes and returns the specified <see cref="AK.Net.Dns.DnsQuery"/>.
        /// </summary>
        /// <param name="query">The query to encode.</param>
        /// <returns>The encoded <see cref="AK.Net.Dns.DnsQuery"/>.</returns>
        /// <exception cref="System.ArgumentNullException">
        /// Thrown when <paramref name="query"/> is <see langword="null"/>.
        /// </exception>
        protected ArraySegment <byte> WriteQuery(DnsQuery query)
        {
            Guard.NotNull(query, "query");

            using (DnsWireWriter writer = new DnsWireWriter()) {
                query.Write(writer);
                return(writer.GetBuffer());
            }
        }