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





Checks if the given element is present in the collection.

Namespace: MindFusion.Mapping
Package: IEnumerable.js

 Syntax

JavaScript  Copy Code

function contains (item)

 Parameters

item

Object. The object to check for.

 Return Value

Boolean. True if the element is found, otherwise false.

 Example

The following code creates new Marker-s and add them to the decorations collection of a DecorationLayer called markers. Then it checks if an item is contained within the collection and if yes - removes it. 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 mark1 = new m.Marker();
mark1.location = new m.LatLong(41.89021, 12.492231);
mark1.imageSrc = "./images/colosseum100.png";
mark1.text = "Colloseum";
markers.decorations.add(mark1);


...........................

if(markers.decorations.contains(mark))
 markers.decorations.remove(mark);

 See Also

IEnumerable Members
IEnumerable Class
MindFusion.Mapping Namespace