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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:19:59+00:00 2026-05-31T04:19:59+00:00

In order to represent the method that executes on a thread I am using

  • 0

In order to represent the method that executes on a thread I am using
ParameterizedThreadStart
and passing the name of the method. In this case the method name is SelectJob and the instantiation is as follows:

ParameterizedThreadStart starter = new ParameterizedThreadStart(SelectJob);

protected void SelectJob(object index)
{
     ...
}

In order to reuse a portion of code I would like, if possible, to store the method name in a variable but the IntelliSense shows the method signature for ParameterizedThreadStart as ParameterizedThreadStart(void (object) target) and I’m not sure how I could store this sort of value. From MSDN I realize this is a delegate so after reading How to: Declare, Instantiate, and Use a Delegate I tried to declare …

delegate void Del(string str);
Del selectDelegate = SelectJob;

… but since the SelectJob method is not static I am not able to do this. Simply making the method static is not an easy option.

Is there another way of making this declaration?

Thanks!

  • 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-31T04:20:00+00:00Added an answer on May 31, 2026 at 4:20 am

    Initialise the delegate instance inside a constructor?

    public class MyClass
    {
        private ParameterizedThreadStart starter;
    
        public MyClass()
        {
            starter = SelectJob;
    
            Del selectDelegate = SelectJob;
        }
    
        delegate void Del(string str);
    
        protected void SelectJob(object index)
        {
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Order object to represent a Prospective Order/Receipt. This is an entity.
I'm just curious if there's a reason why in order to represent -1 in
In order to perform a case-sensitive search/replace on a table in a SQL Server
I have an app that lets people create tickets, and each Account owner using
I have a list of items that have a partial order relation , i.
My current project is split into multiple classes that correctly represent the way we
I have a set of classes that represent the storage of a font format
Sorry that this is a rather large question. I cannot get the following C++
Inputs: n ( int ) and n values ( float ) that represent exchange
I have a HorizontalList control that uses a custom ItemRenderer to represent each item

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.