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


INamedSet.ItemByName Property (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 > INamedSet.ItemByName Property
ArcGIS Developer Help

INamedSet.ItemByName Property

The item corresponding to a given name.

[Visual Basic .NET]
Public Function get_ItemByName ( _
    ByVal Name As String _
) As Object
[C#]
public object get_ItemByName (
    string Name
);
[C++]
HRESULT get_ItemByName(
  BSTR Name,
  IUnknown Pointer* Item
);
[C++]
Parameters
Name [in]

Name is a parameter of type BSTR Item [out, retval]
Item is a parameter of type IUnknown*

Product Availability

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

Remarks

Returns the object associated with the name parameter.

[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

See Also

INamedSet Interface

.NET Samples

Closest facility solver Location-allocation solver Origin-destination cost matrix solver Service area solver Vehicle routing problem solver