Stupid Question

  • Thread starter Thread starter DazedAndConfused
  • Start date Start date
D

DazedAndConfused

If I create:
<Serializable()> _
Public Class CompanyInformation

and it contains members like:

Public Name As String

are those members considered properties?

if not properties, then what is the terminology used for them (I am trying
to figure out proper naming guidelines)?
 
DazedAndConfused said:
If I create:
<Serializable()> _
Public Class CompanyInformation

and it contains members like:

Public Name As String

are those members considered properties?

if not properties, then what is the terminology used for them (I am trying
to figure out proper naming guidelines)?

They are not properties, they are public members.

HTH,

Mythran
 
DazedAndConfused,

VB.Net refers to public variables in a class as fields.

Properties, on the other hand, use Get and Set procedures within a Property
definition.

Kerry Moorman
 
Mythran said:
They are not properties, they are public members.

HTH,

Mythran

Oops, sorry, got stuck on "members" lol...it's Public Fields ;)

Mythran
 
OK, this is where I took a wrong turn.

The naming guidelines in help doesn't list "Public Field Naming Guidelines"
for classes, but it does list "Static Field Naming Guidelines", which is to
use Pascal case.


Now I see "Public Name As String" as a variable, which help suggests using
camel case.

In this situation, which is the best practice for naming "Public Name As
String"?
 
DazedAndConfused said:
OK, this is where I took a wrong turn.

The naming guidelines in help doesn't list "Public Field Naming Guidelines"
for classes, but it does list "Static Field Naming Guidelines", which is to
use Pascal case.


Now I see "Public Name As String" as a variable, which help suggests using
camel case.

In this situation, which is the best practice for naming "Public Name As
String"?

Best practice would say you are not suppose to use public variables in
classes. Best practice would be to do something like:

Public Class as xxxx
Private m_Name as String
public property Name() as string
return Value
get
end get
set(byval value as string)
m_Name = Value
end set
end property
End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top