Class Question
Represents a DNS question section, which contains information about the domain name being queried, the type of query, and the class of query.
public sealed class Question : IEquatable<Question>
- Inheritance
-
Question
- Implements
- Inherited Members
Constructors
Question(string, QuestionType, QuestionClass)
Initializes a new instance of the Question class.
public Question(string domainName, QuestionType questionType, QuestionClass questionClass)
Parameters
domainNamestringThe domain name to query.
questionTypeQuestionTypeThe type of query being performed.
questionClassQuestionClassThe class of the query.
Properties
DomainName
Gets the domain name associated with the DNS question.
public string DomainName { get; }
Property Value
- string
The domain name being queried.
QuestionClass
Gets the query class for the DNS question, determining the protocol group in use.
public QuestionClass QuestionClass { get; }
Property Value
- QuestionClass
The class of the DNS query, such as IN, CS, CH, HS, or Any.
QuestionType
Gets the type of DNS record associated with the question.
public QuestionType QuestionType { get; }
Property Value
- QuestionType
The DNS record type being queried, such as A, MX, or TXT.
Methods
Equals(object?)
Determines whether the specified object is equal to the current Question instance.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance, which may be null.
Returns
Equals(Question?)
public bool Equals(Question? other)
Parameters
Returns
GetBytes()
Converts the question information into a sequence of bytes that can be used in DNS requests or responses.
public IEnumerable<byte> GetBytes()
Returns
- IEnumerable<byte>
An enumerable collection of bytes representing the encoded DNS question fields.
GetHashCode()
Generates a hash code for the current instance of the Question class.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToString()
Converts the current Question instance to its string representation.
public override string ToString()
Returns
- string
A string that represents the current object, including the domain name, class, and type of the query.
Operators
operator ==(Question?, Question?)
Checks whether two Question instances are equal.
public static bool operator ==(Question? left, Question? right)
Parameters
leftQuestionThe first instance to compare, which may be null.
rightQuestionThe second instance to compare, which may be null.
Returns
- bool
True if the two instances are equal; otherwise, false.
operator !=(Question?, Question?)
Determines whether two specified Question objects are not equal.
public static bool operator !=(Question? left, Question? right)
Parameters
leftQuestionThe first instance to compare, which may be null.
rightQuestionThe second instance to compare, which may be null.