[AccessD] First real stumble with using VB.Net over VB

jwcolby jwcolby at colbyconsulting.com
Thu Apr 14 04:39:03 CDT 2011


Drew,

 > Both create a 'property' called SomeValue.

No they don't!  A field is *not* a property.

A field stores data.

A property is code that (may or may not) get / set a field.  Setting a field public makes it emulate 
a property which retrieves that field but the two are not the same thing.


A property may or may not even reference data.  A property may simply return a hard coded value.

property get SomeValue() as int
	SomeValue = 1/3
end property

You may protest till the cows come home that is not what *you* call a property, but none the less it 
is a property.

Private int MyValue

property Get myValue() as int
	return myValue
end property

MyValue is a field not a property.  It stores an integer.

myValue is a property, it gets but does not allow the external world to set, MyValue.

Entirely different.

I understand that you are a lazy programmer, we have had this discussion before.  Your claim was 
IIRC that exposing your fields as public was much less work than making them private and exposing 
them via properties, and properties were pretty much useless.  You fell into the trap of thinking of 
them as the same thing.  Properties are very valuable constructs and exist for a reason.

John W. Colby
www.ColbyConsulting.com

On 4/13/2011 6:22 PM, Drew Wutka wrote:
> Figured I'd post this here, for those that may be tinkering or thinking
> about tinkering with .Net.



More information about the AccessD mailing list