您好我正在使用此链接来实现最快的Observable Collection Best performance for ObservableCollection.AddRange
但是多次调用AddRange()或ReplaceRange()方法时,性能会变慢,例如
AddRange() executed first time in 0.5 sec.
AddRange() executed 2nd Time in 1 sec.
AddRange() executed 3rd Time in 2.5 sec.
即使使用相同的数据,它也会花更多的时间来执行方法。
为了更好地理解,这是一个代码
For Each serie In SeriesList
serie.SeriesDisplayName = "New Series " + newSeriesCounter.ToString()
If newSeriesCounter = 1 Then
serie.Items(1).Number = 500
End If
newSeriesCounter += 1
Next
Series.Clear()
Series.AddRange(SeriesList)