C# Equivalent to VB's WithEvents?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.)
 
Back
Top