Obtain a network dataset from geodatabase feature dataset (fds)
Obtain a network dataset from shapefile workspace (de> shpWSde>)
1
IFeatureDatasetExtensionContainer fdsExtCont = fds
as
IFeatureDatasetExtensionContainer;
2
IFeatureDatasetExtension fdsExt = fdsExtCont.FindExtension(esriDTNetworkDataset);
3
IDatasetContainer2 dsCont = fdsExt
as
IDatasetContainer2;
4
IDataset dataset = dsCont.DatasetByName(esriDTNetworkDataset,
"Street_ND"
);
5
INetworkDataset networkDataset = dataset
as
INetworkDataset;
IWorkspaceExtensionManager wsExtMgr = shpWS as IWorkspaceExtensionManager;
UID myUID = new UIDClass ();
MyUID. Value = "esriGeoDatabase. NetworkDatasetWorkspaceExtension ";
IWorkspaceExtension wsExt = wsExtMgr. FindExtension (myUID );
IDatasetContainer2 dsCont = wsExt as IDatasetContainer2;
IDataset dataset = dsCont. DatasetByName (esriDTNetworkDataset, "Street_ND ");
INetworkDataset networkDataset = dataset as INetworkDataset;
Obtain a network dataset from SDC workspace (de> sdcWSde>)
IWorkspaceExtensionManager wsExtMgr = sdcWS as IWorkspaceExtensionManager; UID myUID = new UIDClass ();
MyUID. Value = "esriGeoDatabase. NetworkDatasetWorkspaceExtension ";
IWorkspaceExtension wsExt = wsExtMgr. FindExtension (myUID );
IDatasetContainer2 dsCont = wsExt as IDatasetContainer2;
IDataset dataset = dsCont. DatasetByName (esriDTNetworkDataset, "Street_ND ");
INetworkDataset networkDataset = dataset as INetworkDataset;