Yes, that would work but it also creates an array larger than what is needed (because the OP only assign a value to the array in the Else block). This won't be a problem in most cases, but if the OP needs a count of the things he has in the array, logArray.Length would give an incorrect answer because there no guarantee that for every iteration of the loop, the execution is branched to the Else block. This means that some of the elements in the array is left empty (nothing). And to get an acutal count, he would have to loop thru the array and test each element to see if it's not = nothing and add 1 to the count.
Using a List(Of T), you don't have this problem.





Reply With Quote