@property
Jussi Jumppanen
jussij at zeusedit.com
Thu Jun 24 18:39:56 PDT 2010
Max Samukha Wrote:
> I don't think the rule applies universally. For example, .NET is full of
> functions starting with Set/Get that are not properties because they
> perform complex/lengthy computations or for some other washy reason.
In .Net it is generally not a good idea to write a getter property that
changes the object in any way (i.e. they should be written as pure read
only).
And why is that you ask?
Because when you watch a object in the debugger the debugger extracts the
object debug information by calling the these getter properties.
So if the object properties are written badly and change the object,
then by just adding that object to a watch window or hovering over
it with the mouse will result in the corruption of the object.
This can make for some very interesting debugging.
More information about the Digitalmars-d
mailing list