How to define a delegate that will have the form a property?
I wand to define a delegate that will have the form a property and not a method.
Let say I have a property:
Code:
public int myProp
{
get { return 0; }
set {}
}
And I want to have a delegate that will take this property as the handler.
Is it possible?
How do I do that?
-----------------------
Thanks in advance
Sharon
Re: How to define a delegate that will have the form a property?
No!
A delegate expects a target and a method to invoke on it.
A property is syntatic sugar for get_Property and set_Property, however, new CustomDelegate(this.get_Property) is not allowed by the compiler.