private void ParseResponse(byte[] buffer) { float temperature = 0.0F; float humidity = 0.0F; bool succeeded = buffer[0] == 1; if (succeeded) { temperature = BitConverter.ToSingle(buffer, 1); humidity = BitConverter.ToSingle(buffer, 5); } Response = new ReadDHT22SensorCommandResponse(succeeded, temperature, humidity); }