示例#1
0
        /// <summary>
        /// Orders the specified sequence of bytes according to the endianness of the parser and the
        /// endianness of the host platform.
        /// </summary>
        /// <param name="bytes">The sequence of bytes to be ordered.</param>
        /// <returns>The specified <paramref name="bytes"/> in reverse order, if the endianness of the
        /// parser does not match the host platform; otherwise, <paramref name="bytes"/> is returned
        /// unmodified.</returns>
        protected IEnumerable <byte> Order(IEnumerable <byte> bytes)
        {
            Contract.Requires(bytes != null);
            Contract.Ensures(Contract.Result <IEnumerable <byte> >() != null);
            Contract.Ensures(Contract.Result <IEnumerable <byte> >().Count() == bytes.Count());

            return(BinaryParser <TResult> .Order(bytes, bigEndian));
        }