B
BobRoyAce
Which is the better way to do things? Is there practically any
difference, or are they essentially the same?
Scenario #1
Dim oList as New List(Of MyObject)
For i As Integer = 1 To 10
Dim oObject as New MyObject
oObject.Property1 = 2
oObject.Property2 = 3
oList.Add(oObject)
Next
Scenario #2
Dim oList as New List(Of MyObject)
Dim oObject as MyObject
For i As Integer = 1 To 10
oObject = New MyObject
oObject.Property1 = 2
oObject.Property2 = 3
oList.Add(oObject)
Next
difference, or are they essentially the same?
Scenario #1
Dim oList as New List(Of MyObject)
For i As Integer = 1 To 10
Dim oObject as New MyObject
oObject.Property1 = 2
oObject.Property2 = 3
oList.Add(oObject)
Next
Scenario #2
Dim oList as New List(Of MyObject)
Dim oObject as MyObject
For i As Integer = 1 To 10
oObject = New MyObject
oObject.Property1 = 2
oObject.Property2 = 3
oList.Add(oObject)
Next