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





Gets the number of elements.

Namespace: MindFusion.Mapping
Package: IEnumerable.js

 Syntax

JavaScript  Copy Code

function count ()

 Return Value

Number. The number of elements.

 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