public static Question FromBytes(byte[] bytes, ref int index) { Question q = new Question(); q.DomainName = DomainName.FromBytes(bytes, ref index); ushort s; Message.FromBytes(bytes, index, out s); index += 2; q.Type = (QType)s; Message.FromBytes(bytes, index, out s); q.Class = (QClass)s; index += 2; return q; }
public static Question Get(BinaryReader reader) { Question q = new Question(); q.DomainName = DomainName.Get(reader); ushort s; Message.FromBytes(reader.ReadBytes(2), out s); q.Type = (QType)s; Message.FromBytes(reader.ReadBytes(2), out s); q.Class = (QClass)((ushort)(s << 1) >> 1); q.CacheFlush = ((ushort)q.Class) != s; return q; }