2
0

tobjectlist_toarray.bmx 493 B

12345678910111213141516171819202122232425
  1. SuperStrict
  2. Framework Brl.ObjectList
  3. Import Brl.StandardIO
  4. ' create an object list to hold some objects
  5. Local list:TObjectList = New TObjectList
  6. ' add some string objects to the end of the list
  7. list.AddLast("one")
  8. list.AddLast("two")
  9. list.AddLast("three")
  10. ' create an array out of the list elements
  11. Local objects:Object[] = list.ToArray()
  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