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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:30:14+00:00 2026-05-31T13:30:14+00:00

I was just starting out on LinqPad and trying some thread snippets in it

  • 0

I was just starting out on LinqPad and trying some thread snippets in it and I was bewildered as to why my code is not doing as predicted to do.

Thread t1 = new Thread
(delegate()
    {
        for (int cycles = 0; cycles < 1000; cycles++)
        {
            Thread.Sleep(500);
            Console.WriteLine("Hello World!");
        }
    }
);
t1.Start();

Console.WriteLine("Soham");

Why is this only printing Soham. The code block inside the thread is not at all executing. I’m not able to understand why because the syntax compiles fine and as far as I I know about c# this should compile fine and run in VS2010 and execute both outputs, even though the order of which cannot be determined. What am I doing or thinking wrong here. I may need some useful tutorials and suggestions to get used to LinqPad.

  • 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-31T13:30:15+00:00Added an answer on May 31, 2026 at 1:30 pm

    Try adding a t1.Join() after the Console.WriteLine("Soham") 🙂 The LINQPad probably sees the main thread terminating and kills everything. With the t1.Join(); the main thread will wait for the other thread to finish.

    Ah… and just tested it 🙂

    I’ll add that you can write in less characters:

    new Thread(() => 
    {
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey - just starting out trying to get some openGL into my iphone app
I'm just starting out with iphone development and ran across some example code that
I'm just starting out with HTML and Dreamweaver. Basicly, I'm trying to create a
I'm just starting out with the whole ajax thing and I need some help.
I'm just starting out writing trying to write a simple program in C and
I'm just starting out with some entity framework exploration, I figured it was time
I am just starting out with ajax...trying to submit a form with ajax through
I Just starting out w/ ASP.NET MVC 3 and I am trying to render
I'm just starting out learning Rails and am trying to figure out how to
I'm just starting out with iOS development and I'm actually trying to make an

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.