Saturday, 12 October 2013

#12. Arrays v/s Collections in QTP

Arrays v/s Collections in QTP:-
1. Arrays are of fixed size.
   Dim arr(3)
   arr = Array(3,1,5)
1. Collections are growable in size.
   Set col = Browser("").Page("").WebEdit("").GetToProperties()
2. For memory usage, Collections are recommended to use instead of Arrays. Because a Collection object uses less memory than an array.
3. Performance wise, arrays are preferred over collections.
4. Arrays can hold basic data types. Whereas, collections can hold only objects.

Properties of a collection:-
   col.Count
   col(i).Name
   col(i).Value
   col(i).RegularExpression
Methods of an array:-
   UBound(arr); LBound(arr)

No comments:

Post a Comment