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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:42:47+00:00 2026-06-06T14:42:47+00:00

There is a method that is called continuously in my program and so I

  • 0

There is a method that is called continuously in my program and so I want to thread it such that the GUI doesn’t freeze whilst it goes about its business.

Thread t = new Thread(Class2.ArrayWorkings(1, MyGlobals.variable1));
    t.start();
        int[] localVariable1 = ??// I want to move the value returned from the method into localVariable1.  

Currently my errors are:

The best overloaded method match for ‘System.Threading.Thread.Thread(System.Threading.ParameterizedThreadStart)’ has some invalid arguments

&

Argument 1: cannot convert from ‘method group’ to ‘System.Threading.ParameterizedThreadStart’

Currently doing this without threading like:

   int[] localVariabl1 = Class2.ArrayWorkings(1, MyGlobals.variable1);
  • 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-06T14:42:47+00:00Added an answer on June 6, 2026 at 2:42 pm

    You can fix the constructor by using a lambda:

    Thread t = new Thread(() => Class2.ArrayWorkings(1, MyGlobals.variable1));
    

    but that doesn’t let you (as Jon notes) get the result straight away – otherwise you are writing synchronous code again. You can instead look to some kind of callback; presumably you need to get back to the UI thread, so:

    Thread t = new Thread(() => {
        // this runs on the worker
        int[] localVariabl1 = Class2.ArrayWorkings(1, MyGlobals.variable1);
        this.Invoke((MethodInvoker)delegate {
            // now we're back on the UI thread!
            update the UI from localVariabl1
        });
    });
    t.Start()
    

    I would probably suggest using the thread-pool, though:

    ThreadPool.QueueUserWorkItem(delegate {
        // this runs on the worker
        int[] localVariabl1 = Class2.ArrayWorkings(1, MyGlobals.variable1);
        this.Invoke((MethodInvoker)delegate {
            // now we're back on the UI thread!
            update the UI from localVariabl1
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a UIView method that is called called after drawRect is completed?
Is there a magic method that when a certain method is called from an
there is a method called viewDidLoad that execute a code when the view is
I have recently found out that there exists a method called nth_element in the
Is there any method so that I can stop syncing to gmail. I want
Is there a way to customize the method that is called when someone touches
I am working with a library called GCDAsyncUDPSocket and there is method that required
If I have a method that is called many times, such as: public int
Hey guys. I have a method that gets called each second which I want
I have a method that gets called into a new thread like so: if

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.