I have a C# property in “public ClassA “as follows: //assume private fields exist
public String Test
{
get
{
return _test;
}
set
{
_test= value;
OnPropertyChanged("Test");
}
}
If I update the value of Test from ClassA member functions I get notified of its property change.
But if I pass this property to a function belonging to some other class, as a parameter, and change its value from there I don’t get notified.
Is it because it’s getting passed by value ?
I thought I would try passing this with ref but that doesn’t compile.
How do I pass this property to any function and still get notified of the change ?
If you pass the property’s value to another method as a parameter, then change its value, the value of the property remains unchanged.
How about passing the parent object and manipulating its properties at the receiving end? After all the setter belongs to that object, not to the value it holds.