Hi,
I recently watched on CH9 a video on MS tool to help optimize code.
I noticed that:
- For i = 0 to MyArray.GetUpperBound(0)
....should be replaced with
- Dim UpperBound as Integer = MyArray.GetUpperBound(0)
- For i = 0 to UpperBound
So I wonder whether I should replace:
- For Each DataRow in DataTable.Rows
or in some situations I may want to use:
- For i = 0 to DataTable.Rows.Count - 1
....should I replace either or both of above with:
- UpperBound = DataRow in DataTable.Rows.Count - 1
- For i = 0 to UpperBound
DataRow = DataTable(i)
Does the .NET Framework have to calculate the datarow count for the
DataTable every time I call DataTable.Rows.Count ?
Do you know of a web page showing examples such as this that I should look
at to ensure my code is fully optimized ?
Thanks
Harry