VentureFree
Well-known member
- Joined
- Jan 9, 2008
- Messages
- 54
- Programming Experience
- 5-10
One would think I'd already know this, but I never really gave it much thought before now. When declaring a member variable for a class, is it better to set the default value at the declaration
Or is it better to do it in the constructor
Should I maybe always specify a value at declaration, even if it's Nothing, and just override that value in the constructor(s) as needed? Or is it situation specific? If so, a really quick rundown of which situations might warrant which treatment would be nice.
VB.NET:
Private m_strMyVariable As String = ""
VB.NET:
Private m_strMyVariable As String
Public Sub New()
m_strMyVariable = ""
End Sub