By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,165 Members | 1,525 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,165 IT Pros & Developers. It's quick & easy.

Optimization advice please

P: n/a
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

Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.