I am using a class with a string property on it. I am looking for some sort of event notification when somebody reads the value of this property, so that I can provide the property dynamically. For example, usually somebody would do:
string foo = someClass.Property;
And it returns whatever string value is currently assigned to Property.
However, I want to say something like:
someClass.PropertyRead += new EventHandler<PropertyReadEventArgs>("Property", Property_Read);
private void Property_Read(object sender, PropertyReadEventArgs e)
{
e.Value = "some dynamically generated string here.";
}
Any idea if something like this is possible?