I would like to know how C# manage and fire events behind the scenes.
For example, in windows forms applications, If we create a button, does C# use polling mechanism to detect button click events?
If so, What is the frequency of this polling? Does it run in separate thread?
Is there a maximum number of events to respect in order to preserve responsiveness of a program?
Update
After reading answers and comments, I understand that windows forms use message pumping. So now, I have hard time to understand how message pumping works. According to @xanatos comment "Winforms uses the Windows API method GetMessage. The GetMessage then returns the first message of the message queue or, if there are no messages, puts the thread into wait mode until a message arrives."
I'm newbie to programming and I cannot see how to put the thread into wait mode until a message arrives. This phrase seems to me as a while loop (or polling). What's the mechanism used to put the thread into wait mode until a message arrives?