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


INamedSet Interface (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (NetworkAnalyst)  

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

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.

CoClasses that implement INamedSet

CoClasses and 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 Snippets

Clear NAClass | Get NAClass | Clear Active Analysis Layer

.NET Samples

Closest facility solver (Code Files: frmClosestFacilitySolver) | ArcGIS Network Analyst extension Engine application (Code Files: cmdClearAnalysisLayer) | Service area solver (Code Files: frmServiceAreaSolver) | Location-allocation solver (Code Files: frmLocationAllocationSolver) | Vehicle routing problem solver (Code Files: frmVRPSolver) | Origin-destination cost matrix solver (Code Files: frmODCostMatrixSolver)

.NET Related Topics

How to generate directions