ArcObjects Library Reference (NetworkAnalyst)  

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,
  LPUNKNOWN* Item
);
[C++]

Parameters

Name [in]   Name is a parameter of type BSTR Item [out, retval]   Item is a parameter of type LPUNKNOWN

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