I have a featureclass with Arcobjects that came from a Shapefile and I wish to import it into a geodatabase. I have the geodatabase connection, I just don't know how to load the feature class to a Geodatabase. Any help would be amazing!
I'm looking for a code example seeing I can't find it by googling. Hopefully in C#, but I don't mind reading through VB if needed.
EDIT:
I wanted to add the Answer thanks to George so here is a code snippet with comments.
ESRI.ArcGIS.Geodatabase.IWorkspace pWorkspace;
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory pWorkspaceFactory;
ESRI.ArcGIS.Geodatabase.IFeatureWorkspace SdeFeatureWorkspace;
pWorkspaceFactory = new FileGDBWorkspaceFactory();
pWorkspace = pWorkspaceFactory.OpenFromFile(@"C:\tests\test.gdb", 0); //Opens the Geodeabase and creates a connection.
SdeFeatureWorkspace = (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)pWorkspace;
IWorkspaceFactory workspaceFactoryShape = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass(); //creates a shape factory to pull the shape and create the feature class.
IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspaceFactoryShape.OpenFromFile(@"C:\Users\Desktop\Newfolder", 0); //Opens the Shape file.
IFeatureClass featureClass = featureWorkspace.OpenFeatureClass("al012009.001_5day_lin"); //opens the featurclass from the shapefile
SdeFeatureWorkspace.CreateFeatureClass("al012009001_5day_linnn", featureClass.Fields, featureClass.CLSID, featureClass.EXTCLSID, featureClass.FeatureType, featureClass.ShapeFieldName, null); //creates a feature class in the geodb.
Geoprocessor gp = new Geoprocessor(); //starts a GEOprocess.
gp.SetEnvironmentValue("workspace", @"C:\Tests\test.gdb"); //sets the geodb to use
ESRI.ArcGIS.DataManagementTools.Append append = new ESRI.ArcGIS.DataManagementTools.Append(); //this tool uploads the feature class
append.inputs = featureClass;
append.target = @"C:\tests\test.gdb\al012009001_5day_linnn";
gp.Execute(append, null);