Properties and delegates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am calling a property on an instance and I'd really like to keep the property around and use it as a callback. Obvious choice is a delegate (a property is really nothing more that a method with set_ generated by the compiler). I can't use the property syntax with a delegate and I can't use the "set_" method name. Is this possible, and if so, what is the syntax
 
A S Carpenter,

Unfortunately, there is none. You will have to create a method that
will set the value on the property, then create a delegate that encapsulates
that method.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

A S Carpenter said:
I am calling a property on an instance and I'd really like to keep the
property around and use it as a callback. Obvious choice is a delegate (a
property is really nothing more that a method with set_ generated by the
compiler). I can't use the property syntax with a delegate and I can't use
the "set_" method name. Is this possible, and if so, what is the syntax?
 
OK, thanks, this is what I was using as a stopgap, I was hoping there was something I was missing that would make this a little prettier.
 
Back
Top