ArcObjects Library Reference  

CommonFunctions

About the ArcGIS Network Analyst extension Engine application Sample

[C#]

CommonFunctions.cs

using ESRI.ArcGIS.Controls;

namespace NAEngine
{
	public static class CommonFunctions
	{
		public static IEngineNetworkAnalystEnvironment GetTheEngineNetworkAnalystEnvironment()
		{
			// The ArcGIS Network Analyst extension environment is a singleton, and must be accessed using the System.Activator
			System.Type t = System.Type.GetTypeFromProgID("esriControls.EngineNetworkAnalystEnvironment");
			var naEnv = System.Activator.CreateInstance(t) as IEngineNetworkAnalystEnvironment;
			return naEnv;
		}
	}
}

[Visual Basic .NET]

CommonFunctions.vb

Imports Microsoft.VisualBasic
Imports System
Imports ESRI.ArcGIS.Controls

Namespace NAEngine
	Public Class CommonFunctions
		Private Sub New()
		End Sub
		Public Shared Function GetTheEngineNetworkAnalystEnvironment() As IEngineNetworkAnalystEnvironment
            ' The ArcGIS Network Analyst extension environment is a singleton, and must be accessed using the System.Activator
			Dim t As System.Type = System.Type.GetTypeFromProgID("esriControls.EngineNetworkAnalystEnvironment")
            Dim naEnv As IEngineNetworkAnalystEnvironment = TryCast(System.Activator.CreateInstance(t), IEngineNetworkAnalystEnvironment)
			Return naEnv
		End Function
	End Class
End Namespace