This document is archived and information here might be outdated.  Recommended version.


INamedSet Interface (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > NetworkAnalyst > ESRI.ArcGIS.NetworkAnalyst > Interfaces > IN > INamedSet Interface
ArcGIS Developer Help

INamedSet Interface

Provides access to a collection of named items.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. Requires Network Analyst Extension.

Members

Name Description
Method Add Add a new named item to the collection.
Read-only property Count The number of items in the collection.
Read-only property Item The item at a given index.
Read-only property ItemByName The item corresponding to a given name.
Read-only property Name The name of the item at a given index.
Method Remove Remove an item from the collection by reference.
Method RemoveAll Empty the collection and remove all items.

Classes that implement INamedSet

Classes Description
NamedSet A collection class with access to the items by index or name.

Remarks

The INamedSet interface provides methods to Add, Remove, and retrieve objects in a NamedSet.

You can retrieve an object stored in a NamedSet by calling Item and passing in an index from 0 to Count - 1 or you can retrieve an object by calling ItemByName.

[C#]

The following C# code shows how you can get the Barriers NAClass from the NAContext's NamedSet object using INamedSet.ItemByName.

public void GetBarrierNAClass(INALayer naLayer)
{

// Get the Current NAContext
INAContext naContext = naLayer.Context;

// Get the NAClass from the NamedSet of NAClasses
INAClass naClass = naContext.NAClasses.get_ItemByName("Barriers") as INAClass;

// Do something with the NAClass
MessageBox.Show(naClass.ClassDefinition.Name);
}
[Visual Basic .NET]

The following VB.NET code shows how you can get the Barriers NAClass from the NAContext's NamedSet object using INamedSet.ItemByName.

Public  Sub GetBarrierNAClass(ByVal naLayer as INALayer)
' Get the Current NAContext
Dim naContext As INAContext = naLayer.Context
  ' Get the NAClass from the NamedSet of NAClasses
Dim naClass As INAClass = naContext.NAClasses.ItemByName("Barriers")
  ' Do something with the NAClass
MessageBox.Show(naClass.ClassDefinition.Name)
End Sub

.NET Samples

Closest facility solver Location-allocation solver ArcGIS Network Analyst extension Engine application Origin-destination cost matrix solver Service area solver Vehicle routing problem solver