ToFloat() public static method

Converts byte array to Float (32 bit float)
public static ToFloat ( byte value, int startIndex ) : float
value byte
startIndex int
return float
コード例 #1
0
        public static float ReadSingle(this MemoryStream stream)
        {
            var res = BStruct.ToFloat(stream.GetBuffer(), (int)stream.Position);

            stream.Position += 4;
            return(res);
        }
コード例 #2
0
        private static object DecodeFloat(string x, int startIndex, out int endIndex)
        {
            startIndex += 1;
            endIndex    = startIndex + 4;

            return(BStruct.ToFloat(Util.StringBytes(x.Substring(startIndex, 4)), 0));
        }
コード例 #3
0
        public float ReadSingle()
        {
            ReadTypeCode(RencodeTypeCode.Single);

            var buffer = new byte[4];

            stream.Read(buffer, 0, buffer.Length);

            return(BStruct.ToFloat(buffer, 0));
        }