O
Ondrej Sevecek
Hello,
I have a general problem in mind. Imagine, you have a private member and its
associated property:
private int member;
public int Member
{ get return member;
set {a better code with event triggering etc.}
}
As actions are associated with the SET method, even the class's inner code
MUST CALL THE PROPERTY method ("Member"). On the other side, when accessing
the member contents, the "member" will be probably quicker.
Is there a method (probably an ATTRIBUTE) which would WARN developer of the
class code itself that he should use the "Member" instead of directly
accessing the "member"? And better, how to WARN him only when SET should be
used through "Member" while GET should warn to use directly the "member"?
I suppose, such a way may exist when you are able to implement "Obsolete"
attribute warnings.
O.
I have a general problem in mind. Imagine, you have a private member and its
associated property:
private int member;
public int Member
{ get return member;
set {a better code with event triggering etc.}
}
As actions are associated with the SET method, even the class's inner code
MUST CALL THE PROPERTY method ("Member"). On the other side, when accessing
the member contents, the "member" will be probably quicker.
Is there a method (probably an ATTRIBUTE) which would WARN developer of the
class code itself that he should use the "Member" instead of directly
accessing the "member"? And better, how to WARN him only when SET should be
used through "Member" while GET should warn to use directly the "member"?
I suppose, such a way may exist when you are able to implement "Obsolete"
attribute warnings.
O.