This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > NetworkAnalyst > ESRI.ArcGIS.NetworkAnalyst > Interfaces > IN > INamedSet Interface > INamedSet.ItemByName Property (ArcObjects .NET 10.4 SDK) |
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
Returns the object associated with the name parameter.
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