Click here to Skip to main content
15,886,776 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Difference between delegate and thread?
Posted
Comments
Sergey Alexandrovich Kryukov 4-Jun-11 22:13pm    
Completely invalid question. "What's the difference between apple and Apple?" Just gibberish. My 1.
--SA

Threads and delegates are different constructs.

A delegate in managed code is a function pointer in other languages. Delegates help us in achieving late binding by allowing us to execute methods on demand. A delegate maintains its own set of parameters that are passed by the client when this delegate is called.

A thread is a different path in a process. Each thread is generally responsible for maintaining its own exception handlers, a priority set and its own context. Threads are an important construct for the Operating System.
 
Share this answer
 
v2
Comments
Kim Togo 4-Jun-11 2:07am    
My 5. Check this link out
http://www.codeproject.com/KB/cs/event_fundamentals.aspx
Abhinav S 4-Jun-11 2:18am    
Thank you Kim.
parthipan from chennai 5-Feb-13 3:27am    
what is difference between delegate and thread? and delegate and event?
Threads and delegates are two completely seperate things. A delegate is a like a variable for a function. In other languages they are called function pointers. These variables can reference one or more functions. Threads allow for multiple execution paths to in application to exist at the same time. So you can be doing more than one thing at the same time in your application.
 
Share this answer
 
v2
Delegates do have limitations, as they use the common thread pool, but they make asynchronous programming so much easier. Unless you need more threads than are available in the thread pool, or need more precise control over thread execution, definitely use delegates.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900