I am currently migrating a VB6 project to VB.NET. I used the VS tool that converts VB6 code to VB.NET code. The conversion changed a VB6 Type to a VB.NET Structure.
The user-defined Type construct was used in a Get/Put where a binary file was read in or written out based on the user-defined Type. Apaprently, the Get/Put was able to do this easily.
During the conversion the Get/Put were changed to FileGet/FilePut but apparently these cannot automatically read in or write out bytes in a Type construct way.
In any event, I decided to replace the FileGet/FilePut code to the .NET FileStream and BinaryReader and BinaryWriter constructs.
What I am now trying to do is to write a class where I take a structure as a paramter and want to read and write the bytes in the same field order as the VB6 Type construct. Looking into the Structure format (which I know is somewhat similar to a Class), there does not seem to be an east way to discern the order the fields are in for reading/writing bytes.
Does anyone have thoughts on the best approach to solving this problem?
0 · ·