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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:58:44+00:00 2026-05-28T00:58:44+00:00

I just trying to pass some values but it’s throwing an error all the

  • 0

I just trying to pass some values but it’s throwing an error all the time. Can some one correct me what I am missing here?

Am getting error here

Thread t_PerthOut = new Thread(new ThreadStart(ReadCentralOutQueue("test"));

I want to pass this string value to ReadCentralOutQueue.

class Program
    {
        public void Main(string[] args)
        {
            Thread t_PerthOut = new Thread(new ThreadStart(ReadCentralOutQueue("test"));
            t_PerthOut.Start();

        }



        public void ReadCentralOutQueue(string strQueueName)
        {
            System.Messaging.MessageQueue mq;
            System.Messaging.Message mes;
            string m;
            while (true)
            {
                try
                {



                        }
                        else
                        {
                            Console.WriteLine("Waiting for " + strQueueName + " Queue.....");
                        }
                    }
                }
                catch
                {
                    m = "Exception Occured.";
                    Console.WriteLine(m);
                }
                finally
                {
                    //Console.ReadLine();
                }
            }
        }
    }
  • 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-28T00:58:45+00:00Added an answer on May 28, 2026 at 12:58 am

    This code:

    Thread t_PerthOut = new Thread(new ThreadStart(ReadCentralOutQueue("test"));
    

    tries to call ReadCentralOutQueue and then create a delegate from the result. That isn’t going to work, because it’s a void method. Normally you’d use a method group to create a delegate, or an anonymous function such as a lambda expression. In this case a lambda expression will be easiest:

    Thread t_PerthOut = new Thread(() => ReadCentralOutQueue("test"));
    

    You can’t just use new Thread(ReadCentralOutQueue) as the ReadCentralOutQueue doesn’t match the signature for either ThreadStart or ParameterizedThreadStart.

    It’s important that you understand why you’re getting this error, as well as how to fix it.

    EDIT: Just to prove it does work, here’s a short but complete program:

    using System;
    using System.Threading;
    
    class Program
    {
        public static void Main(string[] args)
        {
            Thread thread = new Thread(() => ReadCentralOutQueue("test"));
            thread.Start();
            thread.Join();
    
        }
    
        public static void ReadCentralOutQueue(string queueName)
        {
            Console.WriteLine("I would read queue {0} here", queueName);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi im trying to pass some values to a class but it wont let
I'm trying to pass some lat/long values from a JSON doc to iPhone's Map
just trying to test for equality in this piece of code, but getting a
Just trying to establish whether prototype can do something like $$('#ID a:last').css('color','#111'); Any ideas
Just trying to get my head around what can happen when things go wrong
Just trying to canvas some opinions here. I was wondering how people go about
I'm testing some code(trying to make it faster but also trying to understand the
I am trying to pass several values through an IMultiValueConverter to a command (as
I'm trying to pass an keydown event from one textbox to another. What I
I have just hit a confusing problem when trying to compile some code using

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.