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

  • Home
  • SEARCH
  • 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 3442316
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:39:13+00:00 2026-05-18T08:39:13+00:00

I have a 47mb XML file that I have to read over and over

  • 0

I have a 47mb XML file that I have to read over and over and over on my application but mostly it only wants 1 node defined by a given term every now and then.

Example:

<customers>
    <customer>
        <id>someid</id>
        <name>somename</name>
    </customer>
    <customer>
        <id>someid</id>
        <name>somename</name>
    </customer>

    ...

    <customer>
        <id>someid</id>
        <name>somename</name>
    </customer>
    <customer>
        <id>someid</id>
        <name>somename</name>
    </customer>
</customers>

So I was thinking on loading the xml to a Dictionary or List once the programs load up and keep it there to reuse until the application is closed.

  • What I wanted to know what would be
    the best type of stored for it ?

If I have to use a dictionary for example:

private Dictionary<int,string> myCustomerList = new Dictionary<int,string>();

which I could use later to get the information I need like:

if (myCustomerList.ContainsKey(keyX))
    myValue = myCustomerList[keyX];
  • Is this a bad way to go or what
    should I be looking at ?
  • 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-05-18T08:39:14+00:00Added an answer on May 18, 2026 at 8:39 am

    There is nothing functionally wrong with your approach, but what happens when more information is added to the Customer?
    For example, you might have a “location” element:

       <customer>
            <id>someid</id>
            <name>somename</name>
            <location>somename</location>
        </customer>
    

    Also consider the scenario where you move your data to a database – you will have to rewrite a lot of code.

    It is generally considered bad practice to work directly with XML objects through the duration of your application. The “correct” approach is to first load your XML data into Object Oriented objects.

    You should create a class named Customer, and use List<Customer> customers =new List<Customer>() to store the objects. You can then use customers.Find(x=>x.Id == myId) to locate your objects.

    Remember that if you store your objects in memory, your application will use at least 47mb of RAM. This could potentially grow as your business attains more customers. Perhaps you should look at lazy-loading your customers (retrieving them from the XML file when they are required) – this will be slower so it really depends on your throughput and volume requirements.

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

Sidebar

Related Questions

Have an app that can use tts to read text messages. It can also
Have converted devise new session from erb to Haml but doens't work, this is
Have searched the database but need to specifically sum(of hours flown or days off)in
Have a bunch of WCF REST services hosted on Azure that access a SQL
Have a look at one of my websites: moskah.com The problem is that it
Have a simple contact us XPage created. Have server side validation in place that
Have a network location that shows paths in the 8.3 short format. I need
Have data that has this kind of structure. Will be in ascending order by
Have data that has this kind of structure: $input = [ { animal: 'cat',
Have searched for the answer but no joy, so here goes... I'm working on

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.