This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Get NAClass Snippet (ArcObjects .NET 10.4 SDK) |
Get the specified NAClass from a network analysis layer.
///<summary>Get the specified NAClass from a network analysis layer.</summary> /// ///<param name="nalayer">An INALayer3 interface.</param> ///<param name="naClassName">A System.String that is the NAClass to retrieve. Ex: "Stops"</param> /// ///<returns>An INAClass interface.</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.NetworkAnalyst.INAClass GetNAClass(ESRI.ArcGIS.NetworkAnalyst.INALayer3 nalayer, System.String naClassName) { ESRI.ArcGIS.NetworkAnalyst.INAContext naContext=nalayer.Context; ESRI.ArcGIS.NetworkAnalyst.INamedSet namedSet=naContext.NAClasses; ESRI.ArcGIS.NetworkAnalyst.INAClass naClass=namedSet.get_ItemByName(naClassName) as ESRI.ArcGIS.NetworkAnalyst.INAClass; // Dynamic Cast return naClass; }
'''<summary>Get the specified NAClass from a network analysis layer.</summary> ''' '''<param name="nalayer">An INALayer3 interface.</param> '''<param name="naClassName">A System.String that is the NAClass to retrieve. Ex: "Stops"</param> ''' '''<returns>An INAClass interface.</returns> ''' '''<remarks></remarks> Public Function GetNAClass(ByVal nalayer As ESRI.ArcGIS.NetworkAnalyst.INALayer3, ByVal naClassName As System.String) As ESRI.ArcGIS.NetworkAnalyst.INAClass Dim naContext As ESRI.ArcGIS.NetworkAnalyst.INAContext=nalayer.Context Dim namedSet As ESRI.ArcGIS.NetworkAnalyst.INamedSet=naContext.NAClasses Dim naClass As ESRI.ArcGIS.NetworkAnalyst.INAClass=TryCast(namedSet.ItemByName(naClassName), ESRI.ArcGIS.NetworkAnalyst.INAClass) ' Dynamic Cast Return naClass End Function