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

INAContext.NetworkDataset Property (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > NetworkAnalyst > ESRI.ArcGIS.NetworkAnalyst > Interfaces > IN > INAContext Interface > INAContext.NetworkDataset Property
ArcGIS Developer Help

INAContext.NetworkDataset Property

The associated network dataset.

[Visual Basic .NET]
Public ReadOnly Property NetworkDataset As INetworkDataset
public INetworkDataset NetworkDataset {get;}
HRESULT get_NetworkDataset(
  INetworkDataset** NetworkDataset
NetworkDataset [out, retval]

NetworkDataset is a parameter of type INetworkDataset**

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server. Requires Network Analyst Extension.


NetworkDataset returns the NetworkDataset that the NAContext is referencing.

The NetworkDataset is only available after the NAContext has been bound to a NetworkDataset using INAContextEdit::Bind.


This illustrates how you can get the NetworkDataset from the NAContext after it has been bound.

public void CreateContextAndGetNetworkDatasetBackOut(INetworkDataset networkDataset)
  INASolver naSolver = new NARouteSolver() as INASolver;
  IDENetworkDataset deNetworkDataset = ((IDatasetComponent)networkDataset).DataElement as IDENetworkDataset;
  INAContext context = naSolver.CreateContext(deNetworkDataset, naSolver.DisplayName) as INAContext;
  INAContextEdit contextEdit = (INAContextEdit)context;
  contextEdit.Bind(networkDataset, new GPMessagesClass());
  INetworkDataset networkDatasetFromContext = context.NetworkDataset;



See Also

INAContext Interface

.NET Samples

Closest facility solver Location-allocation solver ArcGIS Network Analyst extension barrier location editor ArcGIS Network Analyst extension Engine application Origin-destination cost matrix solver Service area solver Subset network evaluators Subset network evaluators Vehicle routing problem solver