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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:39:23+00:00 2026-05-27T16:39:23+00:00

I need to collect some data and temporarily store it in memory and then

  • 0

I need to collect some data and temporarily store it in memory and then write it to a file.
At first I thought I could just use a Dictionary and made it all work, but when I finnsihed, I realized I need a third element in there, so Dictionarys is of no use I guess.

The three elements would be something like string name, bool asked, DateTime today.

When the function starts, I need to read a file where these elements are stored one per line, separated with a pipe.
As I am going through the function, I will need to add items if a condition evaluates to false in a foreach loop, or remove if the condition is true.
When the function is completed, I need to erase the file, and dump the contents of the array back to the file.

THe meaning would be like checking if John Doe has been asked if his task is completed yet and XX days has passed since he was last asked.
If XX days has passed, remove his record from the array, ask him again, and add new record to the array with todays date. (or simply, changed date in the array and ask again).
Then dump the contents of the array to the file so we can go through it again tomorrow.

I have never worked with arrays before though, so I have absolutely no clue of how to do this.. and when I search google I find a lot of examples, but none that really makes sense to me.

Could any of you let me know how you would proceed with this, as I am completely clueless.

  • 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-27T16:39:24+00:00Added an answer on May 27, 2026 at 4:39 pm

    As a more complete example, consider the following:

    public class SurveyData
    {
        public string Name { get; set; }
        public bool Asked { get; set; }
        public DateTime Date { get; set; }
    }
    
    private Dictionary<string, SurveyData>() SurveyInfo = new Dictionary<string, SurveyData>();
    
    public function LoadData()
    {
        // Code to read from disk omitted for brevity. Assume you've parsed
        // the line into 3 variables: name, asked, date.
    
        var item = new SurveyData()
            {
               Name = name,
               Asked = asked,
               Date = date
            };
    
        this.SurveyInfo.Add(item.Name, item);
    }
    

    With this sample, you’re still using a Dictionary, so you can search by name. But the item data is all stored in the values. So you can do the following:

    public function UpdateIfAsked(string name)
    {
        var item = this.SurveyInfo[name];
        if (item != null)
        {
            // Update the itme or remove it.
            if (item.Asked && item.Date < DateTime.Today)
            {
                SurveyInfo.Remove(item);
            }
        }
    }
    

    PS. This gets much easier with LINQ, but that’s probably a bit advanced for ya at this point.

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

Sidebar

Related Questions

I have a program in which I collect some data and store them temporarily
I need to use PerfMon to collect data from several machines, and I need
I'm building a system that need to collect some user sensitive data via secured
Edited title I am using Core Data to store some data I collect from
I need to make a query to collect some data from a database via
Looking for some help with a Labview data collection program. If I could collect
I have written a small web app to collect some data and store it
I need to write a procedure to collect data from several remote servers, I
i need to write a program in c# to collect information about processes running
in my application I collect some data by the client. On the main layout.xml

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.