Explain the use of ISynchronizeInvoke in cross thread invocation in .NET?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
It’s just an interface which contains appropriate methods to:
InvokeRequired)Invoke)BeginInvokewhich can be coupled withEndInvoketo retrieve the result later)The most commonly known implementation is
Controlin Windows Forms.Basically the problem is that it’s not safe to access UI elements within arbitrary threads. These mechanisms allow calls to be marshalled between threads relatively easily. By only tying yourself to
ISynchronizeInvokeinstead ofControl, you can avoid business classes from being tightly coupled to the UI.EDIT: Stephen’s comment from below is worth repeating here: