Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8988137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:57:14+00:00 2026-06-15T21:57:14+00:00

I’m writing an application in C# using .NET 4.5. My application reads from and

  • 0

I’m writing an application in C# using .NET 4.5. My application reads from and writes to a binary file which is consumed by a hardware device. The file is exactly 5,000,000 bytes and consists of 100,000 50-byte “blocks”. Each 50 byte block will contain an ASCII-encoded string (possibly just an empty string). The file layout is required by the device so that any string can be accessed simply by determining the offset (index * 50 bytes and then reading/writing the next 50 bytes).

My WinForms application needs to be able to:

  • Load all 100,000 strings from the file and display them in the UI (listbox)
  • Add, edit or delete strings
  • Re-write the binary file in the proper format

Caveats:

  1. A fair amount of the data in the binary file will initially be empty strings that I don’t want to display to the user but will still need to be in my data structure so I can re-write the file properly.
  2. Before adding a new string, I need to make sure that there’s free space to allow it (i.e., at least one 50 byte block that’s empty). If not, then the user will need to “delete” an existing string to make room for the new string to be added.
  3. Adding, modifying and deleting strings are, behind the scenes, the same operation. Adding just changes 50 bytes of null data to 50 bytes of string data while deleting represents the reverse.
  4. With the exception of empty strings, duplicate strings shouldn’t be stored so I need some way to iterate through my data structure to ensure that a string doesn’t already exist before adding it or editing a string to match an existing string.

So I’m going to need a data structure to hold all of the data from the file and I’m struggling to decide between a dictionary, a list or an array. Given the caveats above, I don’t think directly binding any data structure to the UI is a viable solution. So I think that I’m going to need a lot of code between that data structure and the listbox to implement some kind of pseudo-binding. If that’s the case, which data structure (dictionary, list, array, something else) would be the most useful from a functional standpoint and offer the best compromise re: speed with a dataset of this size (100,000 strings of up to 50 ASCII character each)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:57:15+00:00Added an answer on June 15, 2026 at 9:57 pm

    Even with 100,000 entries, I don’t think you’re going to need to worry too much about performance. (EDIT: I mean, performance when it comes to I/O or alteration of the data. You likely will have issues with your GUI binding)

    Program it the simplest way that makes it easiest for you to make changes to your business logic and GUI binding. Perhaps even consider creating your own class that simply wraps a List (or Array or whatever) with a standard public interface for your GUI that hides this implementation detail.

    Once your GUI is running and all your I/O is running fine (and ideally, have some nice suite of unit tests), then you can start benchmarking/profiling and finding where your bottlenecks are.

    EDIT: Considering your requirements, this custom/wrapped data structure might be ideal. It can proactively know certain aspects of your data. For example, as it is loaded/read, it can check if space is available for new strings, so when the user goes to add more, you already know if you can. It can maintain a HashSet of used unique strings so you have a nice O(1) lookup for duplicate strings, and so on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a text area in my form which accepts all possible characters from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the
I am trying to understand how to use SyndicationItem to display feed which is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.