how to fix "CS0121 The call is ambiguous between the following methods or properties: 'Thread.Thread(ThreadStart)' and 'Thread.Thread(ParameterizedThreadStart)'"?

G. Gunn - fs 146 Reputation points
2022-05-12T10:30:30.963+00:00

the offending code has
using System;
using System.Windows.Forms;
using System.IO;
using System.Net;
using System.Threading;

and the flagged statement:
new Thread(delegate { getStockInfo(reslt); }).Start();
........

void getStockInfo(string Reslt)
{
.............
}

reslt is of type string and has been assigned value before the thread start.
this is the first attempt to to use thread

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,121 questions
0 comments No comments
{count} votes

Accepted answer
  1. Viorel 118.5K Reputation points
    2022-05-12T10:34:39.42+00:00

    Try a short fix:

    new Thread( ( ) => getStockInfo( reslt ) ).Start( );


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.