示例#1
0
        /// <summary>
        ///   Reads the short async.
        /// </summary>
        /// <returns> </returns>
        public Task <short> ReadShortAsync()
        {
            if (TryGetSegmentFromBuffer(2))
            {
                //reverse the value if necessary
                short value = _lastReadSegment.Array.ToShort(_lastReadSegment.Offset);

                //return cached int value if possible
                return(value.AsTask());
            }

            return(ReadShortInternalAsync());
        }