V2/Cet/IO/Cet.IO/ByteArray/ByteArrayHelpers.Convert.NET.cs
/// <summary>
/// Read an <see cref="System.Single"/> from the given byte array
/// starting from the specified offset, 
/// and composed as the Little-endian format
/// </summary>
/// <param name="buffer">The source byte array</param>
/// <param name="offset">The index of the first byte to be considered</param>
/// <returns>The resulting value</returns>
Read an  from the given byte array
starting from the specified offset,
and composed as the Little-endian format
Read an from the given byte array starting from the specified offset and composed as the Little - endian format
public static Single ReadSingleLE(
            byte[] buffer,
            int offset)
        {
            byte[] temp = new byte[4];
            if (BitConverter.IsLittleEndian)
            {
                temp[0] = buffer[offset];
                temp[1] = buffer[offset + 1];
                temp[2] = buffer[offset + 2];
                temp[3] = buffer[offset + 3];
            }
            else
            {
                temp[3] = buffer[offset];
                temp[2] = buffer[offset + 1];
                temp[1] = buffer[offset + 2];
                temp[0] = buffer[offset + 3];
            }
            return BitConverter.ToSingle(temp, 0);
        }
public static Single ReadSingleLE ( byte [ ] buffer , int offset ) { byte [ ] temp = new byte [ 4 ] ; if ( BitConverter . IsLittleEndian ) { temp [ 0 ] = buffer [ offset ] ; temp [ 1 ] = buffer [ offset + 1 ] ; temp [ 2 ] = buffer [ offset + 2 ] ; temp [ 3 ] = buffer [ offset + 3 ] ; } else { temp [ 3 ] = buffer [ offset ] ; temp [ 2 ] = buffer [ offset + 1 ] ; temp [ 1 ] = buffer [ offset + 2 ] ; temp [ 0 ] = buffer [ offset + 3 ] ; } return BitConverter . ToSingle ( temp , 0 ) ; }
Read an  from the given byte array
starting from the specified offset,
and composed as the Little-endian format
Read an from the given byte array starting from the specified offset and composed as the Little - endian format
The resulting value
The resulting value
buffer
byte[]
The source byte array
The source byte array
offset
int
The index of the first byte to be considered
The index of the first byte to be considered