What’s the best way to convert a float to a byte[4] and then back to a ‘float’?
I am doing this in C# .NET Micro Framework, so there is no BitConverter available for my use.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’ve modified the
BitConverterclass from a Netduino implementation to allow endianness specification (it’s not the “best way”, but it works). If the byte array is sent over the network, I would useBigEndian. Just a reminder thatunsafeis not officially supported in NETMF.