Re: Why use properties?
"James Curran" wrote:
[color=blue]
> "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
> news:MPG.1c1ab4 ce9f48c26798ba3 1@msnews.micros oft.com...
>[color=green]
> > Yes, so long as you don't mind the change in interface. That's the key
> > thing - do you want to maintain interface compatibility as far as
> > possible, or not? I like to on principle, personally.[/color]
>
> But... Are we changing the interface? If a class user were to write
> myObject1.Sales Total = 100.00f;
> it's irrelevant to him if SalesTotal is implemented as a public variable or
> as a property. Nor will he notice if it's changed. (though he will have to
> recompile)
>[/color]
but can you require all production code be recompiled to your changes? I
think that's rather unrealistic.
"James Curran" wrote:
[color=blue]
> "Jon Skeet [C# MVP]" <skeet@pobox.co m> wrote in message
> news:MPG.1c1ab4 ce9f48c26798ba3 1@msnews.micros oft.com...
>[color=green]
> > Yes, so long as you don't mind the change in interface. That's the key
> > thing - do you want to maintain interface compatibility as far as
> > possible, or not? I like to on principle, personally.[/color]
>
> But... Are we changing the interface? If a class user were to write
> myObject1.Sales Total = 100.00f;
> it's irrelevant to him if SalesTotal is implemented as a public variable or
> as a property. Nor will he notice if it's changed. (though he will have to
> recompile)
>[/color]
but can you require all production code be recompiled to your changes? I
think that's rather unrealistic.
Comment