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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:54:21+00:00 2026-06-14T05:54:21+00:00

I am working on a C# library that performs some expensive computation on startup.

  • 0

I am working on a C# library that performs some expensive computation on startup. I would like to cache this computation so that the cost isn’t paid each time the application restarts (think EF and pre-compiled views).

The information I would like to cache is easily writable to a file in text format. Thus, I would like to do the following when the library is invoked:

  1. Generate a unique hash of the configuration parameters.
  2. Check if there is a cache file for that hash. If so, read it in and use it to skip the setup computation.
  3. If not, perform the setup computation and generate an appropriate cache file named by a hash of the configuration parameters.

Furthermore, I don’t want to permanently litter the users’ hard drive such files: I want them to be automatically cleaned up by the operating system (much like temporary files) to the extent that this is possible.

Also, because this is a library I can’t depend on other software being installed. Thus, I’d prefer a pure .NET solution.

Can anyone point me to a good method/.NET APIs for doing something like this?

  • 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-14T05:54:23+00:00Added an answer on June 14, 2026 at 5:54 am

    You should probably use ApplicationData directory to store your cache files, e.g.:

    var cacheDir = Path.Combine(
        Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), 
        "MyApplicationName");
    

    If you want automatic cleanup you can create an empty cache file during the setup so the file will be deleted automatically when your application is uninstalled. Or write the cleanup method yourself in your application’s installer class.

    I don’t think that you can rely on operating system to do the cleanup, Windows can’t even clean its own garbage files.

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

Sidebar

Related Questions

I'm working on a project that generates a iOS static library, and some sample
I am working with a library that performs an operation (I think with LINQ)
I'm currently working on this project that implies some DSP skills. I must extract
I have been working for some time on a library which performs numeric calculations.
I'm working on a library (C++) that will be integrated into clients code. This
I am working with a library that has a blocking call that never times
I am working on a library that allows its users (other libraries residing in
I am working on a media library that lets a user organize files into
I'm working on an application that lists a stored library using a ListActivity. My
I have some library of classes, working with my data, which is being read

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.