C# Equivalent to VB's WithEvents?

G

Guest

Hello,

Thanks for reviewing my question. I am following KB article about creating
a custom control and its source code is in VB. I got to a part where I have
the following:

Private WithEvents mBindingList As IbindingList

What would be the C# equivalent? What is the replacement for WithEvents?

private IBindingList mBindingList;

Thanks for the help.
Peter
 
J

Jon Skeet [C# MVP]

Peter said:
Thanks for reviewing my question. I am following KB article about creating
a custom control and its source code is in VB. I got to a part where I have
the following:

Private WithEvents mBindingList As IbindingList

What would be the C# equivalent? What is the replacement for WithEvents?

There's no equivalent to WithEvents. You need to add and remove events
manually somewhere in your code. (That's what VB.NET is doing under the
covers, along with changing field declarations into properties with
hidden fields, so that if you change a field value it unhooks the old
event and adds a new one.)
 

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

Top