About opening datasets
Given a known dataset name, the easiest way to open a dataset from a workspace is through the IFeatureWorkspace interface, which defines the following "Open" methods that require the name of an existing dataset:
The following code example shows how to open a feature class from a workspace:
[C#] // Cast the workspace to IFeatureWorkspace and open a feature class.
IFeatureWorkspace featureWorkspace=(IFeatureWorkspace)workspace;
IFeatureClass featureClass=featureWorkspace.OpenFeatureClass("Parcels");
[VB.NET] ' Cast the workspace to IFeatureWorkspace and open a feature class.
Dim featureWorkspace As IFeatureWorkspace=CType(workspace, IFeatureWorkspace)
Dim featureClass As IFeatureClass=featureWorkspace.OpenFeatureClass("Parcels")
OpenFeatureClass and OpenRelationshipClass opens both stand-alone classes and classes contained in feature datasets.
See Also:
Connecting to geodatabases and databasesTo use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
- ESRI.ArcGIS.Geodatabase
- ESRI.ArcGIS.System (ESRI.ArcGIS.esriSystem)
Development licensing | Deployment licensing |
---|---|
ArcGIS Desktop Basic | ArcGIS Desktop Basic |
ArcGIS Desktop Standard | ArcGIS Desktop Standard |
ArcGIS Desktop Advanced | ArcGIS Desktop Advanced |
Engine Developer Kit | Engine |