Add BitConverter


Converting between byte[] and eg. float is a rather common action in embedded development.
This is also acknowledged by functions such as Microsoft.SPOT.Hardware.Utility.ExtractValueFromArray.
This just needs a few more overloads and be a bit more standardized (Eg. the .net BitConverter).
Closed Jul 16, 2014 at 6:57 PM by smaillet_ms
This was added in the 4.3.1 QFE


Illishar wrote Dec 9, 2010 at 9:13 AM

Woops, how do I change the type from "Issue" to "Feature"?

wrote Dec 9, 2010 at 12:20 PM

MikeIssa wrote Dec 9, 2010 at 8:28 PM

This is commonly requested. It is on NETMF's road map. See the Documentation page.
GHI added an overload to do float conversion in our library.
Personally, I like the Utility methods more than BitConverter for efficiency reasons. It is very common to convert numbers to byte arrays many times during an application runtime. BitConverter returns a new byte array every time whereas Utility methods can insert into an existing array.

GHI Electronics

Illishar wrote Dec 10, 2010 at 7:39 AM

I agree about the efficiency issue. But the ExtractValueFromArray etc. should at least be moved to the standard BitConverter class and namespace. (For consistency.) And you might also consider renaming the functions so they'll match the existing ones.

Illishar wrote Dec 10, 2010 at 8:11 AM

"It is on NETMF's road map. See the Documentation page."

I can't seem to find it anywhere on the road map. Do you have access to a better version that the one on codeplex?

I see you're assigned to the PWM/Analog issue though. Very nice! I were afraid that GHI would keep to themselves with all the wonderful things you've been creating. PWM is not your best shot though. How about redesigning your RLP to real P/Invokes and then contribute those? ;)

MikeIssa wrote Dec 10, 2010 at 6:21 PM

I see BitConverter at the bottom after the PWM by a couple of lines...


Illishar wrote Dec 13, 2010 at 7:09 AM

Hm, I only see "BitArray" in that area. (System.Collections.BitArray hasn't got anything to do with System.BitConverter. Furthermore I cannot understand why anyone would want to add the BitArray to tinyclr. It doesn't really add anything besides code spam.)

MikeIssa wrote Dec 14, 2010 at 3:40 PM

Oops, I read it wrong.

wrote Jan 8, 2011 at 11:05 PM

wrote Jan 18, 2011 at 4:55 PM

wrote Feb 24, 2011 at 8:14 PM

juliusfriedman wrote Mar 20, 2011 at 7:53 PM

@ Zach, Lorenzo, MSchwarts.

You guys are more then welcome to utilize my BitConverter, which expands upon the ByteReader, ByteWriter done my MSchwartz.


wrote Jun 12, 2011 at 3:48 AM

wrote Jun 14, 2011 at 10:16 AM

wrote Jun 28, 2011 at 12:54 AM

wrote Aug 1, 2011 at 8:56 PM

wrote Sep 7, 2011 at 3:24 PM

wrote Sep 11, 2011 at 4:19 PM

wrote Dec 2, 2011 at 3:33 AM

wrote Jan 24, 2012 at 8:15 PM

wrote Jan 26, 2012 at 9:14 AM

wrote Jan 29, 2012 at 8:45 PM

wrote Jul 2, 2012 at 3:04 PM

wrote Aug 5, 2012 at 2:20 AM

wrote Oct 11, 2012 at 8:37 PM

wrote Nov 4, 2012 at 5:47 AM

wrote Dec 26, 2012 at 10:23 AM

wrote Dec 27, 2012 at 10:07 PM

wrote Jan 30, 2013 at 8:30 AM

wrote Feb 12, 2013 at 3:19 PM

wrote Feb 14, 2013 at 5:58 AM

wrote Feb 22, 2013 at 12:46 AM

wrote Apr 22, 2013 at 4:15 AM

NicolasG wrote Jul 22, 2013 at 8:20 PM

If you want to compile your own solution, the full implementation is available here.

wrote Sep 27, 2013 at 7:50 PM

wrote Jan 19, 2014 at 4:17 AM

wrote Mar 10, 2014 at 6:10 PM

wrote Jul 16, 2014 at 6:57 PM