473,473 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

What should my thread signature look like if I want to return a String?

I want my thread method to return a String. However, the compiler is
saying that the best overloaded method match for
System.Threading.Thread has some invalid arguments. Not sure what I
need to change here.

public String generateNOV(string xmlParms)
{
Thread novThread = new Thread(delegate()

tia,
chance.

Apr 2 '07 #1
3 1480
On Apr 2, 8:41 am, "chance" <cha...@crwmail.comwrote:
I want my thread method to return a String. However, the compiler is
saying that the best overloaded method match for
System.Threading.Thread has some invalid arguments. Not sure what I
need to change here.

public String generateNOV(string xmlParms)
{
Thread novThread = new Thread(delegate()

tia,
chance.
The delegate needs to follow ParameterizedThreadStart's signature
which is void func(object state);

Apr 2 '07 #2
On Mon, 02 Apr 2007 05:41:37 -0700, chance <ch****@crwmail.comwrote:
I want my thread method to return a String.
A .NET Thread cannot "return a string", or any value for that matter.

If you want a thread to do some processing and emit a string, you need to
define some mechanism by which the string is explicitly set somewhere else
and then can be retrieved by whatever other thread wants to use the string.

Pete
Apr 2 '07 #3
Hi,
A thread cannot have a return value.

You have to store the value in a variable accesible from both the creator
and the thread.
The creator should not be able to access it until the thread had set the
value in the variable though.

"chance" <ch****@crwmail.comwrote in message
news:11*********************@y66g2000hsf.googlegro ups.com...
>I want my thread method to return a String. However, the compiler is
saying that the best overloaded method match for
System.Threading.Thread has some invalid arguments. Not sure what I
need to change here.

public String generateNOV(string xmlParms)
{
Thread novThread = new Thread(delegate()

tia,
chance.

Apr 2 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what...
12
by: Kim | last post by:
I have a .NET service sending mails using CDOEX. These mails I need to sign. I got a tip that I should use CAPICOM. That worked fine sending a mail with signature. BUT the problem is that I...
6
by: Alfonso Morra | last post by:
I have written the following code, to test the concept of storing objects in a vector. I encounter two run time errors: 1). myClass gets destructed when pushed onto the vector 2). Prog throws a...
5
by: Mark Broadbent | last post by:
I have written a class that has a public method which could take some time to complete (20 secs). The idea is for it to raise an event on completion. Should I create a separate thread for this...
44
by: Viken Karaguesian | last post by:
Hello all, On occasion I want to open hyperlinks (images, etc.) in a new window. In the past, I've used target="_blank" to open the link in a new window. However, using the "target" attribute...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
5
by: Mo | last post by:
I am trying to set a text box value when data is received from the com port (barcode reader). I am getting the following error when I try to set the text box TXNumber after data is received ...
14
by: =?Utf-8?B?QUEyZTcyRQ==?= | last post by:
Am I correct in thinking that the <signatureof a function is its <syntax> i.e. the arguments and the order in which they are specified when calling the function?
3
by: vainstah | last post by:
Hello Guys and Galls, To start off, I have reached the solution I was looking for, but I would like comments and feedback on the solution I have reached and tips/tricks on making it more elegant....
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.