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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:08:12+00:00 2026-05-25T10:08:12+00:00

I am sure this is pretty standard stuff, but I can’t seem to wrap

  • 0

I am sure this is pretty standard stuff, but I can’t seem to wrap my head around this.

I’m writing a simple helper class for executing code in separate threads. I’m very familiar with how to do this in general, but not using lambdas. I guess this is about general lambda usage, rather than threads.

What I want to be able to write is something like this:

ThreadedMethods.Parameterized<int>((i) => { for (;i < 10; i++;) DoSomething();});

and

ThreadedMethods.Parameterized<IEnumberable<Something>>((list) => 
{
    foreach (var s in list)
    {
         s.SomeHeavyProcessing();
    }
});

Is this possible? And, moreover, is there any reason to try to achieve this in the first place, since the lambda will have access to everything within the scope of the method call?

  • 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-25T10:08:12+00:00Added an answer on May 25, 2026 at 10:08 am

    Sure, it is possible. You should have implementation for

    class ThreadedMethods {
        public static void Parameterized<T>(Action<T> action) {
            // Start the action on a different thread using possibly ThreadPool.QueueUserWorkItem
        }
    }
    

    Then you call your implementation as you have shown with your examples in your question.

    EDIT: More info on how you can call the ThreadPool.QueueUserWorkItem method when you have Action

        public void StartOnDifferentThread<T>(Action<T> action, T input)
        {
            ThreadPool.QueueUserWorkItem(o => action((T)o), input);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im sure this is pretty simple but I just cant seem to find the
I'm sure this is pretty elementary but I'm new to php. Can someone tell
I am pretty sure this has been answered before but I cannot seem to
Pretty sure this has been asked already, but I don't know what to search
I'm pretty sure this is some stupid mistake from me but i haven't been
Im pretty sure this has a simple solution. I am using jCarousellite, and i
So I'm using this pretty standard jquery plugin pattern whereby you can grab an
I am sure this has something to do with IIS but I can't figure
Am pretty sure this is a cake 1.3 question - the plugin is not
I'm running Mysql 5.0.77 and I'm pretty sure this query should work? SELECT *

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.