Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Disallow changing properties of properties?

$
0
0

I am working on a class we will call "NetVector" that is a set of custom vector structures that I have written (which I have called SimpleDirectionalVector).

The point is to track a net vector based on the value of all component vectors.  However, if I update a component vector directly, I would like to have the NetVector do its own housekeeping.  The problem is that if I create a property (accessor) that allows one to get access to the component vectors directly, any component can be changed without notifying the owning "NetVector".  Is there a way around this?

I suppose I could create events associated with changing the values of the component vectors which can then change the resulting vector (if a handler delegate is instanced).  However, is there a way to simply disable/disallow changing the property of a property of a class so that if I want to handle it by using functions only, I can?


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>