I am reading a Binary file, it has several blocks, each block has different names/data. Some of this data is string value, date, datetime, time but most of them are integer value.

Previously I code a struct for each Block and create public member to hold each property of that block, and then I make a Wrapper class this wrapper class has Object of each Block Class and we assign values within this wrapper class to keep complete file in one object.

Now, I am looking for more efficient way of doing it as our previous code was not very efficient and I have to rewrite all Block classes, but just thought if there is easy and more efficient way of doing it. Maybe I should use List or Dictionary object instead ? What you think is best of doing it.

Btw my files are 100MB + and hence it is lot of data as file is binary when it is 100MB :).

  • An SQL database? – Konrad Morawski Jun 19 '13 at 11:21
  • Yes, we have to read that file in SQL database, but some of values need in memory object for reporting and stuff. and again unless file is completely read successfully we cannot insert in main table. – Sumit Gupta Jun 19 '13 at 11:23
  • As always when having performance problems: use a profiler to find out the "hot spots" in your program. Honestly, from that bits of information you gave here it is impossible to say why your previuos code was not efficient. If you found the hot spots, you should post some example code (at stackoverflow, not here), and ask more specificially for a solution. – Doc Brown Jun 19 '13 at 17:10
  • can you give some starting point on "profiler" what it is and how can I use or at least where to look for it. thanks. – Sumit Gupta Jun 20 '13 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.