Applying It

Try to complete the following exercises by yourself.

Independent Exercise 1

Write an example that measures the performance of the Add methods for an ArrayList, HashTable, and SortedList.

Hint: Use a large number of objects (10000, for instance) so that you can measure the time consistently. Also see the note that follows on how to measure the length of an operation.

Independent Exercise 2

Modify the preceding example to measure the performance of a search operation for the three classes. For the ArrayList use a loop. Alternatively, you could use the advanced BinarySearch method.

Note

To measure the time it takes to execute an operation, ...

Get Visual Basic® .NET by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.