Get the Network Analyst extension from the application.
[C#]
///<summary>Get the Network Analyst extension from the application.</summary> /// ///<param name="application">An IApplication interface.</param> /// ///<returns>An INetworkAnalystExtension interface.</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.NetworkAnalystUI.INetworkAnalystExtension GetNetworkAnalystExtension(ESRI.ArcGIS.Framework.IApplication application) { ESRI.ArcGIS.esriSystem.IExtension extension = application.FindExtensionByName("Network Analyst"); ESRI.ArcGIS.NetworkAnalystUI.INetworkAnalystExtension networkAnalystExtension = extension as ESRI.ArcGIS.NetworkAnalystUI.INetworkAnalystExtension; // Dynamic Cast return networkAnalystExtension; }
[Visual Basic .NET]
'''<summary>Get the Network Analyst extension from the application.</summary> ''' '''<param name="application">An IApplication interface.</param> ''' '''<returns>An INetworkAnalystExtension interface.</returns> ''' '''<remarks></remarks> Public Function GetNetworkAnalystExtension(ByVal application As ESRI.ArcGIS.Framework.IApplication) As ESRI.ArcGIS.NetworkAnalystUI.INetworkAnalystExtension Dim extension As ESRI.ArcGIS.esriSystem.IExtension = application.FindExtensionByName("Network Analyst") Dim networkAnalystExtension As ESRI.ArcGIS.NetworkAnalystUI.INetworkAnalystExtension = TryCast(extension, ESRI.ArcGIS.NetworkAnalystUI.INetworkAnalystExtension) ' Dynamic Cast Return networkAnalystExtension End Function