Sunday, July 5, 2009

KiXtart: Array List Sorting


Function ArrayList()
; this code creates and populates an ArrayList
? "Example: ArrayList object"
$myArrayList = CreateObject("System.Collections.ArrayList")
$=$myArrayList.Add("Dog")
$=$myArrayList.Add("Chicken")
$=$myArrayList.Add("Rooster")
$=$myArrayList.Add("Hen")

; Now, to add an element and sort the ArrayList, all we need to do is:

; [1] add the new element to the ArrayList
$=$myArrayList.Add("Pig")
; [2] sort the ArrayList
$=$myArrayList.Sort()
For each $item in $myArrayList
? $item
Next
EndFunction

$x = ArrayList()

1 comment:

  1. Just what I needed !!!
    awesome feature ...
    Many THANKS !

    ReplyDelete