My Language is C#.
obj1.Value = "test";
If object value is changed like this, it is easy to handle. I can put the event code in Name Property Set.
But
Class obj1 = new Class("string1");
obj1 = new Class("string1");
When object is changed by assignment like this, How can I know that and Handle it?
I want to limit Name Length and it is limited by another property "Length".
I have 3 constructors.
Class(string value);
Class(int length);
Class(int length, string value);
And 2 Properties.
.Value
.Length
I made obj1 like this
Class obj1 = new Class(3, "ab")
My problem is this.
obj1 = new Class("abcde")
I want to limit Value length 3 but the length of new Class("abcde") is 5. (It can have different value by coding but in my case length is 5)
How can I solve it?