Persistence mod: Can't remove objects after loadin
BlitzMax Forums/Brucey's Modules/Persistence mod: Can't remove objects after loadin
| ||
| Hi, I have the problem that I can't remove objects from a list after loading it. Without saving/loading the list the remove method works fine. Example:
SuperStrict
Import BaH.persistence
Local alien:TAlien
alien = New TAlien' creates an alien in the TAlien.list
' save TAlien.list
Local tp:TPersist = New TPersist
tp.SerializeToFile(TAlien.list, "TAlienlist.txt")
' Clear the list
TAlien.list.Clear
' reload the list
tp.DeSerializeFromFile("TAlienlist.txt")
For Local toclear:TAlien = EachIn TAlien.list
'toclear = Null ' does not work
toclear.remove 'does not work although
Next
' TAlien.list.Clear() ' this works..
DebugLog ("Listsize TAlienlist:" + TAlien.list.Count())
Type TAlien
Global list:TList = New TList
Field link:TLink
'
Method New()
link = list.AddLast(Self)
End Method
'
Method Remove()
link.Remove()
End Method
End Type
|