C
CMM
"Joergen Bech @ post1.tele.dk>" <jbech<NOSPAMNOSPAM> wrote in message
I'm a strong advocate for initializing in the declaration (and so is MS in
their guidelines and the entire world outside of VB).
'arrays should be initialized
Private myArray As Integer() = {}
'objects should be initialized (most of the time)
Private myArrayList As New ArrayList
'and, yes, string objects should be initialized and not left as Nothing
'unless you actually need to do something particular with "Nothing."
Private myStr As String = String.Empty
This initialize-in-declaration is less less important IF you do NOT provide
a default New() and instead *require* parameters to be passed into it ( like
New(ary, arrayList, str) )
the class is modified later. Suppose we have an uninitialized
ArrayList member variable and the accessor knows that it should
be created on first access. <snip>
I'm a strong advocate for initializing in the declaration (and so is MS in
their guidelines and the entire world outside of VB).
'arrays should be initialized
Private myArray As Integer() = {}
'objects should be initialized (most of the time)
Private myArrayList As New ArrayList
'and, yes, string objects should be initialized and not left as Nothing
'unless you actually need to do something particular with "Nothing."
Private myStr As String = String.Empty
This initialize-in-declaration is less less important IF you do NOT provide
a default New() and instead *require* parameters to be passed into it ( like
New(ary, arrayList, str) )