I do this... but its probably not the greatest approach
public bool CreateFileGDB(ref string error, string fullshapefilepath, String shapeFileDirectory, String shapeFileName, string badfields, ShapefileType shapefiletype, string Style )
{
try
{
string projectionfile = fullshapefilepath.ToUpper().Replace(".SHP", ".PRJ");
string dbffile = fullshapefilepath.ToUpper().Replace(".SHP", ".DBF");
ISpatialReference spREF = null;
if (File.Exists(projectionfile))
spREF = MapLibrary.Get().srFactory.CreateESRISpatialReferenceFromPRJFile(projectionfile);
else //assume standard coords
spREF = MapLibrary.Get().standardSpatialReference;
string GDBPath = shapeFileDirectory + shapeFileName.Replace(".shp", ".gdb");
if (!Directory.Exists(GDBPath))
{
string InputFields = badfields;
string RequiredFields = string.Empty;
if (shapefiletype == ShapefileType.Point || shapefiletype == ShapefileType.Polygon)
RequiredFields = US_One_Address_with_Zone_Required_Fields;
else
RequiredFields = US_Streets_with_City_State_ZIP;
string[] input = InputFields.Split(splitter);
string[] output = RequiredFields.Split(splitter, StringSplitOptions.RemoveEmptyEntries);
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory pWorkspaceFactory = new FileGDBWorkspaceFactoryClass();
string dir = string.Empty;
string filename = string.Empty;
Util.GetDirectoryFileName(GDBPath, ref dir, ref filename);
//input
IWorkspaceName pInShpWorkspaceName = new WorkspaceNameClass() as IWorkspaceName;
pInShpWorkspaceName.PathName = shapeFileDirectory;
pInShpWorkspaceName.WorkspaceFactoryProgID = "esriCore.ShapefileWorkspaceFactory";
IFeatureClassName pFCName = new FeatureClassNameClass() as IFeatureClassName;
IDatasetName pShpDatasetName = pFCName as IDatasetName;
pShpDatasetName.Name = shapeFileName;//this is your input file
pShpDatasetName.WorkspaceName = pInShpWorkspaceName;
IName sourceName = (IName)pFCName;
IFeatureClass sourceFeatureClass = (IFeatureClass)sourceName.Open(); //fails
IFields sourceFields = sourceFeatureClass.Fields;
List<string> fieldnames = GetFieldNames(sourceFields);
//output
IWorkspaceName pWorkspaceName = new WorkspaceNameClass() as IWorkspaceName;
pWorkspaceName.WorkspaceFactoryProgID = "esriDataSourcesGDB.FileGDBWorkspaceFactory";
pWorkspaceName.PathName = GDBPath; //output file
IFeatureClassName pOutputFC = new FeatureClassNameClass();
IDatasetName pDataSetName = pOutputFC as IDatasetName;
pDataSetName.WorkspaceName = pWorkspaceName;
pDataSetName.Name = "Streets";
IFeatureDataConverter pShpToFc = new FeatureDataConverterClass();
for (int i = 0; i < input.Length; i++)
RenameColumn(sourceFields, input[i], output[i]);
List<string> newfieldnames = GetFieldNames(sourceFields);
if(shapefiletype == ShapefileType.Point)
{
IGeometryDef def = Create_IGeometryDef(spREF, esriGeometryType.esriGeometryPoint);
pShpToFc.ConvertFeatureClass(pFCName, null, null, pOutputFC, def, sourceFields, "", 1000, 0);
}
else if(shapefiletype == ShapefileType.Polygon)
{
IGeometryDef def = Create_IGeometryDef(spREF, esriGeometryType.esriGeometryPolygon);
pShpToFc.ConvertFeatureClass(pFCName, null, null, pOutputFC, def, sourceFields, "", 1000, 0);
}
else if (shapefiletype == ShapefileType.Polyline)
{
IGeometryDef def = Create_IGeometryDef(spREF, esriGeometryType.esriGeometryPolyline);
pShpToFc.ConvertFeatureClass(pFCName, null, null, pOutputFC, def, sourceFields, "", 1000, 0);
}
else
pShpToFc.ConvertFeatureClass(pFCName, null, null, pOutputFC, null, sourceFields, "", 1000, 0);
}
return true;
}