Home Dashboard Directory Help

System.IO.BinaryReader & BinaryWriter need to support Big-endian formats. by aptitude



Sign in
to vote
Type: Suggestion
ID: 484149
Opened: 8/20/2009 8:21:14 AM
Access Restriction: Public


BinaryReader and BinaryWriter are used to read and write to and from a number of different stream types, not just local files. Some of these streams may be communicating with devices that require Big-endian format data and it would be extremely useful if BinaryReader and BinaryWriter supported this.
Sign in to post a comment.
Posted by Maleman719 on 7/16/2013 at 10:51 AM
Any update if this will ever be added and if yes in which version?
Posted by aptitude on 12/11/2010 at 11:12 AM
Really guys I wish you would spend more time improving and fixing the existing framework rather than adding ever more modules. The fact that the BinaryReader can't handle big endian is so fundamentally rubbish that it should have been sorted in version 1.1 not version 6.
Posted by Microsoft on 12/10/2010 at 9:39 PM
Thanks again for taking the time to report this. Unfortunately, we won't be able to get to this for the next release of .NET, so I'm resolving this as Won't Fix.


Justin Van Patten
Program Manager
Common Language Runtime
Posted by Alfred Myers on 10/8/2009 at 1:45 PM
VHD file format footer also lays out their integer fields as big endian
Posted by Microsoft on 8/24/2009 at 12:30 PM
Hi Hasl;jfaksljfhlkasjfhlaskjdfhl,

Thanks for the suggestion! Adding the ability to specify the endianness of BinaryWriter/Reader would be useful. Unfortunately we aren't planning to add support for this in .NET 4, but this is something we'll consider for a future release. Therefore, I'm going to go ahead and keep this suggestion open for tracking.

Please let me know if you have any questions or concerns at justinv at microsoft dot com.


Justin Van Patten
Program Manager
CLR Base Class Libraries
Posted by Microsoft on 8/20/2009 at 10:41 PM
Thank you for your feedback, We are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Kudzu22 on 6/22/2012 at 8:13 PM
You can also use Array.Reverse:

     Array.Reverse(aData, 12, 4);
     ClientAddr = BitConverter.ToUInt32(aData, 12);
Posted by Alfred Myers on 10/8/2009 at 1:43 PM
Use a third-party class library such as described at http://stackoverflow.com/questions/1540251/binarywriter-endian-issue