
07-04-2012, 03:26 PM
|
 |
Bald Mountain Survivor
Super Moderator * Expert *
|
|
Join Date: Aug 2003
Location: Oregon, USA
Posts: 5,877
|
|
My understanding of the backgroundworker is fuzzy at best so your example poses more questions than answers for me.
This is what I was thinking.
Code:
Public Class Form1()
Private oCarDefaults as New VehicleDefaults(4,4,false)
'...
'Elsewhere in an event : oCarDefaults = New VehicleDefaults(6,2,True) Then create a slew based on these defaults.
End Class
Public Class Vehicle
Public Property Defaults = Nothing
Public Property VehicleColor as color
Public Property License as string = ""
'...
Public Sub New(defauits as vehicledefaults, vehiclecolor as color, license as string, ...)
Defaults = defaults
VehicleColor = vehiclecolor
License = license
'...
End Sub
End Class
Public Class VehicleDefaults
' This class is created only once.
' Defaults are changed rarely if at all.
Public Cylinders as integer = 0
Public Seats as integer = 0
Public Convertable as boolean = false
'...
Public Sub New(cylanders as integer, seats as integer, convertable as boolean)
' Set Props
End Sub
End Class
The idea is to reduce the number of parameters and the number of times you have to set them.
|
__________________
Burn the land and boil the sea
You can't take the sky from me
~T
|