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

ToUInt32() public static method

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

Usage Example

Example #1
0
 /// <summary>
 /// Read specified bit length content as an UInt32 type and increase the bit offset with the specified length.
 /// </summary>
 /// <param name="readingLength">Specify the reading bit length.</param>
 /// <returns>Return the UInt32 type value.</returns>
 public uint ReadUInt32(int readingLength)
 {
     byte[] uint32Bytes = this.GetBytes(readingLength, 4);
     return(LittleEndianBitConverter.ToUInt32(uint32Bytes, 0));
 }