Properties in Class

  • Thread starter Thread starter NachoShaw
  • Start date Start date
N

NachoShaw

Guest
Hey

Probably a stupid question but something ive never quite understood (new to more complicated classes)...

I have set up a class with a series of Set Get properties like this (only one here for the example)

Public Class MySettings
Private ReadOnly objReg As New GetSetRegistry

Friend Property ApplyMaterial As Boolean
Set(ByVal value As Boolean)
objReg.WriteValue("ApplyMaterial", value)
End Set
Get
Return objReg.ReadValue("ApplyMaterial")
End Get
End Property

Public Sub New()

End Sub
End Class


GetSetRegistry is another Class that has the Read / Write functions

In my form, i call the class like this

Friend GetSetProps As MySettings = New MySettings

and then will be wanting to Get Property values like this

Dim GetMats As String = GetSetProps.ApplyMaterial

and set the property like this

Dim Whatever As String = "SomeMaterial"
GetSetProps.ApplyMaterial = Whatever


My Question is, with the structure above, do the properties get loaded as i call New even though there isnt a method call within the New method? In other words, by simply creating a new instance on the class, are all of the properties populated or do i need to call something from the New() method to invoke the population?

Like i said, probably a stupid question to some but these are quite new to me.


Thanks







Im a self taught VB.Net guy who writes code for Autodesk Inventor. I may not know the terminology but i try so please be patient. Im not a kid so please dont treat me like one :)

Continue reading...
 
Back
Top