Add better BigEndian support via BitConverter

The following suggestion was made by Keith Hill, via the BCL Web Site:
"We have to deal with binary files that are in a standard format which is big endian. It would have been nice to use the BitConverter and/or BinaryReader/Writer classes but they are fixed to support only little endian. Could you consider updating these classes to support big endian byte order?"
Keith, this has not been the first time we've heard this kind of request, and we are already tracking it for consideration in a future version of the framework. It's great to get another vote for the feature, so it gives it more weight, thanks!

Comments (2)

  1. Anonymous says:

    While you guys are considering this, could I ask for some enhanced overloads on the BitConverter’s ToString method?

    Essentially, I’d like to be able to specify the separator used on the string that is created, much like Guid a bunch of format codes for different Guid string formats. The immediate application of this for me is in building LDAP binding string and search filters from binary data. Often I have to create a binding string like <SID=xxxx> where xxxx is the octet string format of the binary SID (little endian for AD….) with NO separator characters. Other times I need to build an LDAP search filter which requires a prefix of in front of each hex pair.

    It seems like this would be trivially easy to add and would probably help out more people than just the LDAP developers out there.

    Maybe even some format string that would allow you to specify the case of the hex digits would be possible?

    Thanks in advance for the consideration!

  2. Anonymous says:

    Antoher fair suggestion, and we’ll keep a track on that one also: thanks Joe!

Skip to main content