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


Opening datasets (ArcObjects .NET 10.5 SDK)

Opening datasets


Summary
This topic discusses how to open datasets from a workspace. Specifically, it shows how to open datasets from the classic dataset model (feature classes, tables, feature datasets, and relationship classes).

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 databases




To 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):
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