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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:30:49+00:00 2026-06-14T09:30:49+00:00

I have 3 lists of the following type: folderName : String FTPcount : Int

  • 0

I have 3 lists of the following type:

  1. folderName : String
  2. FTPcount : Int
  3. Expectedcount : Int

All are related to each other (based on their index in the list) and I want to pass them as argument to BackGroundWorker which reads the folderName while increments FTPcount and Expectedcount.

How can I pass them (by reference ? ) such that I will be able to see the increments after each one has finished its execution ?

        List<string> folderName = new List<string>();
        List<int> Expectedcount = new List<int>();
        List<int> FTPcount = new List<int>();

        foreach (string folder in Properties.Settings.Default.Folders)
        {
            BackgroundWorker bg = new BackgroundWorker();

            bGs.Add(bg);
            Expectedcount.Add(new int());
            FTPcount.Add(new int());
            folderName.Add(folder);

            bg.DoWork += new DoWorkEventHandler(Process_Instiution);
            bg.RunWorkerAsync(new { folderName = folder, Expected = Expectedcount[Expectedcount.Count - 1] as object, FTP = FTPcount[FTPcount.Count - 1] as object });
        }

        while (true)
        {
            bool IsBusy = false;
            foreach (BackgroundWorker bg in bGs)
                if (bg.IsBusy)
                {
                    IsBusy = true;
                    break;
                }

            if (IsBusy)
                Application.DoEvents();
            else
                break;
        }
        //Code to read the various List and see how many files were expected and how many were FTPed.
  • 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-14T09:30:50+00:00Added an answer on June 14, 2026 at 9:30 am

    Use the DoWork(Object data) method that specifics the argument. You will have to cast and it retrieve it from args Argument Property.

    I would either create a object wrapper to pass the data or use an anonymous type.

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

Sidebar

Related Questions

I have the following table that lists all awarded cups: Name: Cups Columns: Month,
I currently have the following SQL query that lists all the names of all
I have the following code which utilises Guava's Files.readLines() method: List<String> strings = Lists.newArrayList();
Say we have the following structure: struct Tree { string id; int numof_children; Tree
I'm experimenting with HList based typed heterogeneous lists. I have defined the following: import
I have the following code which produces a dictionary containing multiple lists; each list
I have following: temp = aaaab123xyz@+ lists = [abc, 123.35, xyz, AND+] for list
I have the following code: SPList list = web.Lists[this.ListName]; SPListItem item = list.Items.Add(); now
I'm trying to map a Dictionary containing Lists. I have the following set of
I have the following List<int> collection and I need to find the highest integer

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.