Dkode,
Personally, I use the property, not the field that is backing it. The
reason for this is that with properties, there can be code that affects the
return value. More often than not, it is this kind of encapsulation that
you want when using properties, so it is best to use them everywhere that
you expose them (otherwise, it would be pointless to have the property in
the first place).
I say only in places where there is an explicit reason to not use the
property, you should use the field.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
"DKode" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Ok,
>
> kind of a silly question I just want to know what the proper method is,
>
> When I have local Properties, ie:
>
> private bool _someVal;
> public bool SomeVal {
> get { return _someVal; }
> }
>
> When I accessing this property within the class it exists in, should I
> use _someVal or always use the Property to retrieve the value? I guess
> it really doesn't make a different but I noticed this is one part of my
> code that isn't consistent, sometimes I use the property sometimes I
> don't is there any OOP rules here to follow? THank you
>