BACnet.Tagging.TagReader.AtTag C# (CSharp) Method

AtTag() public method

Checks whether the next tag to be read matches a certain tag
public AtTag ( byte tag, ApplicationTag defaultTag ) : bool
tag byte The tag number to check for, or 255 for an application tag
defaultTag ApplicationTag The application tag to check for
return bool
        public bool AtTag(byte tag, ApplicationTag defaultTag)
        {
            bool ret = false;
            bool hasHeader = _peekHeader();

            if(hasHeader)
            {
                bool context = (tag != 255);
                byte tagNumber = (context ? tag : (byte)defaultTag);
                return (_isContext == context && _tagNumber == tagNumber);
            }

            return ret;
        }