Microsoft.Protocols.TestSuites.SharedAdapter.LittleEndianBitConverter.ToInt32 C# (CSharp) Method

ToInt32() public static method

Returns a 32-bit signed integer converted from two bytes at a specified position in a byte array.
public static ToInt32 ( byte array, int index ) : int
array byte Specify an array of bytes.
index int Specify the starting position.
return int
        public static int ToInt32(byte[] array, int index)
        {
            CheckByteArgument(array, index, 4);
            return unchecked((int)ConvertFromBytes(array, index, 4));
        }

Usage Example

Example #1
0
        /// <summary>
        /// Deserialize items from byte array.
        /// </summary>
        /// <param name="byteArray">The byte array which contains response message.</param>
        /// <param name="currentIndex">The index special where to start.</param>
        /// <param name="lengthOfItems">The length of items.</param>
        protected override void DeserializeItemsFromByteArray(byte[] byteArray, ref int currentIndex, int lengthOfItems)
        {
            if (lengthOfItems != 4)
            {
                throw new StreamObjectParseErrorException(currentIndex, "Win32Error", "Stream object over-parse error", null);
            }

            this.ErrorCode = LittleEndianBitConverter.ToInt32(byteArray, currentIndex);

            currentIndex += 4;
        }
All Usage Examples Of Microsoft.Protocols.TestSuites.SharedAdapter.LittleEndianBitConverter::ToInt32