title: Fastest method to check if an array is empty
body: <p>I want to know the fastest way to check if an array is empty in VB.NET. The array is already initialized so I can't use any of the checks that look at that. This is the current code below:</p>
  <pre><code>If Not (cubes(threadnumber)(i).objects.GetLength(0) = 0) Then
     cubes(threadnumber)(i).objects = New Double() {}
     ReDim cubes(threadnumber)(i).objects(-1)
  End If
  </code></pre>
  <p>I've done some testing and I know that using <code>.GetUpperBound</code> is a little faster, but I'm not sure if this will work because I think <code>.GetUpperBound</code> returns a 0 if the array length is 1.</p>
  <p>Any/all methods to speed this up (even fractionally) will be tremendously helpful. This program takes ages to compleate and the first line of the above code is a big portion of the time, it's called 136 million times.</p>
  <p>Also if anyone knows how to speed up For...Next loops that'd be great too!</p>