This is a question I should know the answer to, so please forgive me for asking....
If I wanted to move data from one collection to a new (empty) collection, would this be the correct method?
myColA .... collection of XYZEntity (contains data)
myColB .... collection of XYZEntity (empty)
Move items from "A" to "B".
Dim myLine as XYZEntity
For each myLine in myColA
if myLine.ProductID > 2000 then
Dim NewLine As XYZEntity = myColB.AddNew
NewLine = myline 'copies the data from the existing entity
NewLine.IsNew = True
NewLine.Amount = 0 'make changes to the new entity
myColB.Add(NewLine) 'add the entity to the new collection
end if
Next
I'm confused as to what the AddNew does. Could we not just create a new entity and then add it.
Like:
Dim NewLine as new XYZEntity
NewLine.ID = 11
NewLine.Amount = 999
....
myColB.Add(NewLine)
Thanks for your help!