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


Get Current Network Layer Snippet (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference

Get Current Network Layer Snippet

Get the current network layer from the Network Analyst extension.

[C#]
///<summary>Get the current network layer from the Network Analyst extension.</summary>
/// 
///<param name="networkAnalystExtension">An INetworkAnalystExtension interface.</param>
/// 
///<returns>An INetworkLayer interface.</returns>
/// 
///<remarks></remarks>
public ESRI.ArcGIS.Carto.INetworkLayer GetCurrentNetworkLayer(ESRI.ArcGIS.NetworkAnalystUI.INetworkAnalystExtension networkAnalystExtension)
{

  ESRI.ArcGIS.Carto.INetworkLayer networkLayer=networkAnalystExtension.CurrentNetworkLayer;

  return networkLayer;

}
[Visual Basic .NET]
'''<summary>Get the current network layer from the Network Analyst extension.</summary>
''' 
'''<param name="networkAnalystExtension">An INetworkAnalystExtension interface.</param>
''' 
'''<returns>An INetworkLayer interface.</returns>
''' 
'''<remarks></remarks>
Public Function GetCurrentNetworkLayer(ByVal networkAnalystExtension As ESRI.ArcGIS.NetworkAnalystUI.INetworkAnalystExtension) As ESRI.ArcGIS.Carto.INetworkLayer

  Dim networkLayer As ESRI.ArcGIS.Carto.INetworkLayer=networkAnalystExtension.CurrentNetworkLayer

  Return networkLayer

End Function

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Carto
  • ESRI.ArcGIS.NetworkAnalystUI