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

The Archive Base Latest Questions

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

I have an xml file that will be read many times from the source

  • 0

I have an xml file that will be read many times from the source code. I would like to know the efficient way in which i can read only once [ during application start ] the xml file and then cache its contents so that i can reuse it efficiently and fastly.

I am using C# 4. Kindly suggest the best practice for efficient caching and reading.

EDIT

Found this resource : CodeProject Article

I have loaded the xml file into an XmlDocument and Cached it using Enterprise Library as follows,

XmlDocument xdoc = new XmlDocument();
xdoc.Load("MyXmlFile.XML");
FileDependency fileDependency=new FileDependency("MyXmlFile.XML");
cacheManager.Add("XConfig", xdoc, CacheItemPriority.Normal, null, fileDependency);
  • 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-29T08:49:40+00:00Added an answer on May 29, 2026 at 8:49 am

    To read the xml is XmlReader, look: The most efficient way to parse Xml

    And caching use a XmlDocument Object, and keep it in memory: C# Best way to hold xml data

    To use both together, look: http://msdn.microsoft.com/en-us/library/a8ta6tz4.aspx

    The problem with XmlDocument is to read, not to manipulate, the best way to manipulate is Linq to Xml, that has a good performance as well, but don’t beat the XmlReader, look this comparisons: http://www.nearinfinity.com/blogs/joe_ferner/performance_linq_to_sql_vs.html

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

Sidebar

Related Questions

I have an XML file that I would like to map some attributes of
Let's say I have to read from a directory that has many large XML
I have an xml file from an external system that looks like this. <?xml
I have an XML file that starts like this: <Elements name=Entities xmlns=XS-GenerationToolElements> I'll have
I have an XML file that looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I was given an .xml file that I needed to read into my code
I have a code as such that reads in an xml file into a
I have some xml files that will be read-only that I need to access
I have xml file that after my application installation will located in the installation
We have XML generated from an external program that needs to be read into

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.