Re: Reason for Accessor Methods
- From: "Bruce Wood" <brucewood@xxxxxxxxxx>
- Date: 1 Nov 2005 17:52:53 -0800
I think that you're confusing properties with fields. The OP was asking
for reasons why you would prefer to write this:
Thing someThing = myObject.GetSomething();
rather than this:
Thing someThing = myObject.Something;
where Something is a property with a getter (and perhaps a setter).
Certainly, it's preferable to expose properties rather than expose
fields directly. The question was, why would you prefer to write a Get
method rather than use a property with a getter.
.
- Follow-Ups:
- Re: Reason for Accessor Methods
- From: David Farr
- Re: Reason for Accessor Methods
- References:
- Re: Reason for Accessor Methods
- From: David Farr
- Re: Reason for Accessor Methods
- Prev by Date: Re: FileSystemWatcher on a network drive that gets disconnected
- Next by Date: Re: oledb and FindBy[ColumnName] for DataGrids
- Previous by thread: Re: Reason for Accessor Methods
- Next by thread: Re: Reason for Accessor Methods
- Index(es):
Relevant Pages
|