tobjectlist_copy.bmx 615 B

123456789101112131415161718192021222324252627282930313233
  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. ' copy the list elements into another one
  11. Local list2:TObjectList = list.Copy()
  12. ' enumerate all the strings in the first list
  13. For Local a:String = EachIn list
  14. Print a
  15. Next
  16. ' enumerate all the strings in the second list
  17. For Local a:String = EachIn list2
  18. Print a
  19. Next
  20. ' outputs:
  21. ' one
  22. ' two
  23. ' three
  24. ' one
  25. ' two
  26. ' three