This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > NetworkAnalyst > ESRI.ArcGIS.NetworkAnalyst > Interfaces > IN > INamedSet Interface (ArcObjects .NET 10.5 SDK) |
Provides access to a collection of named items.
Description | ||
---|---|---|
Add | Add a new named item to the collection. | |
Count | The number of items in the collection. | |
Item | The item at a given index. | |
ItemByName | The item corresponding to a given name. | |
Name | The name of the item at a given index. | |
Remove | Remove an item from the collection by reference. | |
RemoveAll | Empty the collection and remove all items. |
CoClasses and Classes | Description |
---|---|
NamedSet | A collection class with access to the items by index or name. |
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.
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);
}
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