ArcObjects Library Reference (GeoDatabase)  

IFeatureWorkspace.OpenFeatureClass Method

Opens an existing feature class.

[Visual Basic .NET]
Public Function OpenFeatureClass ( _
    ByVal Name As String _
) As IFeatureClass
[C#]
public IFeatureClass OpenFeatureClass (
    string Name
);
[C++]
HRESULT OpenFeatureClass(
  BSTR Name,
  IFeatureClass** FeatureClass
);
[C++]

Parameters

Name [in]   Name is a parameter of type BSTR FeatureClass [out, retval]

  FeatureClass is a parameter of type IFeatureClass

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Remarks

The OpenFeatureClass method can be used to open any existing feature class in the workspace given its fully qualified name. Note that every feature class in a geodatabase has a unique fully qualified name, and the OpenFeatureClass method can be used to directly open feature classes that are part of a feature dataset (the feature dataset name does not need to be specified).

Use the IDatabaseConnectionInfo interface to determine the User and Database (if applicable).  ISQLSyntax::QualifyTableName can be used to determine the fully qualified name for a feature class.  Use the NameExists method on the IWorkspace2 interface to determine if a feature class with the appropriate name exists in a geodatabase.

Opening a feature class that participates in a topology or geometric network will also open all other feature classes participating in the topology or geometric network in memory.

Some examples of how to use the Name parameter of OpenFeatureClass are shown below:

For Coverage feature classes:
buildings:polygon
For Oracle feature classes (the owner prefix is unnecessary if you are connected as the owner of the feature class):
gdb.Buildings
For SQLServer feature classes:
fdo_data.gdb.Buildings
For Informix feature classes:
bladetest2:gdb.Buildings
For VPF feature classes:
ks032193:veg:vgfarea (library:coverage:feature class)
The library name for VPF data is case sensitive and must appear as it is stored in the LAT (Library Attribute Table)
The 4 tables associated with a Topology; T_#_DirtyAreas, T_#_PolyErrors, T_#_LineErrors and T_#_PointErrors cannot be directly edited. For this reason they cannot be opened and will fail with a general Geodatabase error.

See Also

IFeatureWorkspace Interface

.NET Snippets

Add Shapefile Using OpenFileDialog | Create FeatureClass | Get FeatureClass From Shapefile On Disk

.NET Samples

Closest facility solver (Code Files: frmClosestFacilitySolver) | Add a custom menu created in .NET to ArcGIS for Desktop (Code Files: AddShapefile) | Cut polygons without selection edit task (Code Files: EditingForm) | Custom reshape polyline edit task (Code Files: EditingForm) | 3D dynamic element tracking (Code Files: TrackDynamicObject) | Service area solver (Code Files: frmServiceAreaSolver) | Managing snap agents (Code Files: EditingForm) | Location-allocation solver (Code Files: frmLocationAllocationSolver) | Vehicle routing problem solver (Code Files: frmVRPSolver) | Automate ArcGIS for Desktop applications (Code Files: Form1) | Simple point plug-in data source (Code Files: OpenSimplePointDlg) | Origin-destination cost matrix solver (Code Files: frmODCostMatrixSolver) | Custom vertex editing commands (Code Files: EditingForm) | RSS weather GraphicTracker (Code Files: RSSWeather) | Bind a geodatabase table to a .NET control (Code Files: MainWind) | Buffer snap agent (Code Files: EditingForm) | RSS weather layer (Code Files: RSSWeatherLayerClass) | Route layer (Code Files: Program) | Edit event listener (Code Files: EditingForm)

.NET Related Topics

Adding a custom menu created in .NET to ArcGIS for Desktop | Adding a plug-in data source programmatically | Automating ArcGIS for Desktop applications | Creating a topology in the geodatabase | Creating an address locator | Creating relationship classes | Geodatabase | Geodatabase API best practices | How to add different types of layers to a map | How to change label formats and marks on an axis using a line graph | How to create a 3D pie graph | How to create a box plot graph | How to create a dynamic geocoded feature class | How to create a function series graph | How to create a histogram graph | How to create a selection set using a scatter plot graph | How to create a vertical stack area graph | How to create graph series with different color types | How to create multiple vertical bar graphs | How to get CAD transformation properties (from, to, angle, and scale) | How to get the points of a two-point CAD transformation | How to merge conflicting geometries during a reconcile | How to rematch a geocoded feature class | How to return CAD drawing layer properties | How to return CAD transformation settings | How to set CAD transformation properties (from, to, angle, and scale) | How to set the points of a two-point CAD transformation | How to sort data in the graph | How to standardize an address | Leveraging the schema cache | Location | Opening datasets | Performing a spatial analysis operation using objects