I have an object model that looks like this:
public class MyModel
{
public List<MyOtherObject> TheListOfOtherObjects { get; set; }
public List<int> MyOtherObjectIDs { get; set; }
public void GetListOfMyOtherObjectIDs()
{
// function that extracts the IDs of objects in
// the list and assigns it to MyOtherObjectIDs
}
}
At the moment, I’ve got some code that executes GetListOfMyOtherObjectIDs when TheListOfOtherObjects gets populated from a query. Now I’ve got another place in the code that populates this list as well and when it does, it also needs to execute the GetListOfMyOtherObjectIDs function.
Is there a way to make this process automatic so that when TheListOfOtherObjects is popuplated, regardless of which code triggers it, the object model will automatically execute GetListOfMyOtherObjectIDs?
Use you own
setaccessor: