473,804 Members | 3,211 Online
Bytes | Software Development & Data Engineering Community
+ 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.Threadin g.Thread has some invalid arguments. Not sure what I
need to change here.

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

tia,
chance.

Apr 2 '07 #1
3 1493
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.Threadin g.Thread has some invalid arguments. Not sure what I
need to change here.

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

tia,
chance.
The delegate needs to follow ParameterizedTh readStart'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******** *************@y 66g2000hsf.goog legroups.com...
>I want my thread method to return a String. However, the compiler is
saying that the best overloaded method match for
System.Threadin g.Thread has some invalid arguments. Not sure what I
need to change here.

public String generateNOV(str ing 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
6818
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 the issue is. Thanks Ravi
12
10703
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 have to type the password for my certificate every time my program signs a mail :o( My program is a windows service running on a server so typing passwords is
6
2582
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 "SEGV" when run (presumably - attempt to delete deleted memory. Please take a look and see if you can notice any mistakes I'm making. Basically, I want to store classes of my objects in a vector. I also have three further questions:
5
1394
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 lengthy operation inside the class itself OR as I suspected let any calling code of the class's method worry about threading? -- Br,
44
9461
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 causes my pages to fail validation (strict doctype). The validator says "There is no attribute 'target'.." So...how do I open a link in a new window, without Javscript, and pass strict validation?
669
26266
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 paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
5
11120
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 Cross-thread operation not valid: Control 'TXNumber' accessed from a thread other than the thread it was created on. Any ideas how to work around this problem? Thanks
14
4631
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
6438
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. I am not satisfied with the underlying machinery of the solution though. I am an advanced C programmer and most do object-based programming in C++. Please do not reply to this article with references to basic material or obvious tips. An...
0
10338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10082
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
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, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6856
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2997
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.