ASP.NET Pack Programmer's Guide
IEnumerable.copyTo Method
See Also
 





Copies a range of elements from this collection to a destination collection.

Namespace: MindFusion.Mapping
Package: IEnumerable.js

 Syntax

JavaScript  Copy Code

function copyTo (destination, length, [sourceIndex, [destinationIndex]])

 Parameters

destination

IEnumerable. The destination collection.

length

Number. The length of the range to copy.

sourceIndex
Optional.

Number. The starting index of the range to copy.

destinationIndex
Optional.

Number. The index at which the range should be copied.

 Example

The following code creates two DecorationLayer-s and adds Marker instances to them. Then it checks if the count of items in the first layer is more than 10 and if yes - copies the first 10 at the end of the second collection. The decorations property is of type ObservableCollection, which derives from IEnumerable.

JavaScript  Copy Code

var m = MindFusion.Mapping;

var markers = new m.DecorationLayer("Images");

// create some markers with images
var mark = new m.Marker(new m.LatLong(-22.951916, -43.210487));
mark.imageSrc = "./images/christ_redeemer.png";
mark.text = "Christ the Redeemer";
markers.decorations.add(mark);
...........................

var markers2 = new m.DecorationLayer("Images2");
var mark1 = new m.Marker();
mark1.location = new m.LatLong(41.89021, 12.492231);
mark1.imageSrc = "./images/colosseum100.png";
mark1.text = "Colloseum";
markers2.decorations.add(mark1);
....................................

if(markers.decorations.count > 10)
{
  
   markers.decorations.copyTo(markers2, 10, 0, markers2.count);
}

 See Also

IEnumerable Members
IEnumerable Class
MindFusion.Mapping Namespace