listtoarray.bmx 494 B

12345678910111213141516171819202122232425
  1. SuperStrict
  2. Framework Brl.LinkedList
  3. Import Brl.StandardIO
  4. ' create a list to hold some objects
  5. Local list:TList = CreateList()
  6. ' add some string objects to the end of the list
  7. ListAddLast(list, "one")
  8. ListAddLast(list, "two")
  9. ListAddLast(list, "three")
  10. ' create an array out of the list elements
  11. Local objects:Object[] = ListToArray(list)
  12. ' enumerate all the strings in the array
  13. For Local a:String = EachIn objects
  14. Print a
  15. Next
  16. ' outputs:
  17. ' one
  18. ' two
  19. ' three