WithEvents ???

G

Guest

Is there any additional overhead for declaring a variable using the
WithEvents keyword even if none of the events are being handled?
 
N

NoOne

Is it possible that its just a keyword for the visual basic compiler that
connects an object's events to some handlers? C# and Visual Basic both
compile to IL, if it did have overhead (other than compilation) it would
have to show up there.
 
S

solex

I am pondering here but would imagine that there is no overhead because I
would again imagine that the MSIL compiler is very efficient and would
realize that there are no eventsinks for the object and hence remove and
event handling code.

A question for you is why would you declare an object withEvents if you do
not plan on using them?
 
T

Tom Spink

Hi NoOne,

You are correct, WithEvents (in conjuction with the Handles clause) removes
the arduous task of AddHandler and RemoveHandler on all events for any
controls you make.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

" System.Reflection Master "

==== Converting to 2002 ====
Remove inline declarations
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top