Gets the number of MapItems which are currently selected.

Namespace:  ESRI.ArcGISExplorer.Application

Assembly:  ESRI.ArcGISExplorer.Application (in ESRI.ArcGISExplorer.Application.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public int Count { get; }
Visual Basic (Declaration)
Public ReadOnly Property Count As Integer

Field Value

An integer indicating the number of selected items.

Remarks

This property can be used in conjunction with the Item[([(Int32])]) indexed property to iterate through each selected item by index position. Alternatively, SelectedItemsCollection is also enumerable.

Examples

The code below shows two different ways to enumerate through the items in the SelectedItemsCollection, by using the implementation of IEnumerable, and also by using the Item indexed property and the Count property.
CopyC#
// Get the collection of selected items from the application.
ESRI.ArcGISExplorer.Application.SelectedItemsCollection selItems = ESRI.ArcGISExplorer.Application.Application.SelectedItems;

// 1 - Enumerate using IEnumerable implementation.
foreach (MapItem itm in selItems)
{
  System.Diagnostics.Debug.WriteLine(itm.Name);
}

// 2 - Enumerate using Item and Count properties.
for (int i = 0; i < selItems.Count; i++)
{
  System.Diagnostics.Debug.WriteLine(i.ToString() + ":" + selItems[i].Name);
}
CopyVB.NET
' Get the collection of selected items from the application.
Dim selItems As ESRI.ArcGISExplorer.Application.SelectedItemsCollection = ESRI.ArcGISExplorer.Application.Application.SelectedItems

' 1 - Enumerate using IEnumerable implementation.
For Each itm As MapItem In selItems
  System.Diagnostics.Debug.WriteLine(itm.Name)
Next itm

' 2 - Enumerate using Item and Count properties.
For i As Integer = 0 To selItems.Count
  System.Diagnostics.Debug.WriteLine(i.ToString() & ":" & selItems(i).Name)
Next i

See Also