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 8574979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:35:42+00:00 2026-06-11T19:35:42+00:00

I have a text file which follows exactly the same type: **Unique-Key_1** Value1 Value2

  • 0

I have a text file which follows exactly the same type:

**Unique-Key_1**
Value1
Value2

**Unique-Key_2**
Value1

**Unique_Key_3**
Value1

(Please note that the keys and values are not fixed.They might grow in time but one thing is confirmed: It will always follow this structure)

My program wants to search for a key and then retrive all values under it.

I have some viable solutions for this.

1) Should I use a dictionary type and then when my app loads read all keys and values and populate that list?

2) Can I use file access/search methods during run-time and based upon a key , search it and then retrieve values ?

3) Which is the optimum method or is there any methods or any other ways to achieve the same ?

  • 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-11T19:35:43+00:00Added an answer on June 11, 2026 at 7:35 pm

    Things to consider:

    1. Does the application have time to load in and parse the file before data is searched? If so, consider parsing the file into a Dictionary. If not, parse the file as needed.
    2. Will the file be very large? If so, parsing it into a Dictionary may take up too much memory. Consider an LRU Cache like Object cache for C#.
    3. Are the keys in the file sorted? If so, a binary search on the file may be possible to speed up the file parses.
    4. Does the data change frequently? If so, parsing the file would guarantee the data is up to date at the cost of slower data access.

    Another alternative is to load the values into database tables or a key/value store. This allows the data to be updated piece meal or completely with reasonable access speed if needed at the expense of maintaining and running the database.

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

Sidebar

Related Questions

I have a plain text file which have the list of countries as follows.
I have text file (seq.fasta) which contains sequence as follows M1 MPMILGYWNVRGLTHPIRMLLEYTDSSYDEKRYTMGDAPDFDRSQWLNEKFKLGLDFPNL PYLIDGSHKITQSNAILRYLARKHHLDGETEEERIRADIVENQVMDTRMQLIMLCYNPDF EKQKPEFLKTIPEKMKLYSEFLGKRPWFAGDKVTYVDFLAYDILDQYRMFEPKCLDAFPN
I have a text file which has a particular line something like sometext sometext
I have a text file which I am reading and storing the data in
I have a text file which contains data seperated by '|'. I need to
I have a text file which I want to filter using awk. The text
I have a text file which needs to be constantly updated (regular intervals). All
I have a text file which contains something like this: Hello, my name is
I have a text file in which a particular character repeats at the start
I have a huge text file which I want to explode into an array.

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.