Dynamicaly Removing and adding Polyline


I had already added some number of polylines through PolylineCollection in which i am giving position value from json data on the initial loading.Now on after getting new json data in small interval i need to remove all the original created polylines and create new polyline which will be have new cordinates.

I tried to put original collection(PolylineCollection) into one javascript object(var objectOld) and on updating of json I tried to use method removeAll() on that object, it didnot worked and gave a rendering error. While if I tried to use method destory() on that object, i was able to remove all existing Polyline, but it is not able to create New Polyline as given by json object.

Can you make a stripped down sample of your code in Sandcastle so we can see what’s happening?