using System; namespace DnsClient { /// /// The class transports information of the lookup query performed by . /// /// A list of questions is returned by (although, the list will always contain only one ). /// /// public class DnsQuestion { /// /// Gets the domain name the lookup was runnig for. /// /// /// The name of the query. /// public DnsString QueryName { get; } /// /// Gets the question class. /// /// /// The question class. /// public QueryClass QuestionClass { get; } /// /// Gets the type of the question. /// /// /// The type of the question. /// public QueryType QuestionType { get; } /// /// Initializes a new instance of the class. /// /// The query. /// Type of the question. /// The question class. /// If is null. public DnsQuestion(string query, QueryType questionType, QueryClass questionClass = QueryClass.IN) : this(DnsString.Parse(query), questionType, questionClass) { } /// /// Initializes a new instance of the class. /// /// The query. /// Type of the question. /// The question class. /// If is null. public DnsQuestion(DnsString query, QueryType questionType, QueryClass questionClass = QueryClass.IN) { QueryName = query ?? throw new ArgumentNullException(nameof(query)); QuestionType = questionType; QuestionClass = questionClass; } /// public override string ToString() { return ToString(0); } /// /// Returns the information of this instance in a friendly format with an optional . /// /// The optional offset which can be used for pretty printing. /// The string representation of this instance. public string ToString(int offset = -32) { return string.Format("{0," + offset + "} \t{1} \t{2}", QueryName.Original, QuestionClass, QuestionType); } } }