internal static String[] GetFeatureClassNames(IWorkspace TheWrkspc)
{
String[] TheNames = new String[0];
IEnumDatasetName TheFCNames;
IDatasetName OneFCName;
// iterate through all the Feature Datasets...
IEnumDatasetName TheFDNames = TheWrkspc.get_DatasetNames(esriDatasetType.esriDTFeatureDataset);
IDatasetName OneFDName = TheFDNames.Next();
while (OneFDName != null)
{
// iterate through all the Feature Classes in the Dataset...
TheFCNames = OneFDName.SubsetNames;
OneFCName = TheFCNames.Next();
while (OneFCName != null)
{
if (OneFCName.Type == esriDatasetType.esriDTFeatureClass)
{
// add each Feature Class name to the listbox
System.Array.Resize<String>(ref TheNames, TheNames.Length + 1);
TheNames[TheNames.Length - 1] = OneFCName.Name;
}
// ...and continue iterating...
OneFCName = TheFCNames.Next();
}
// ...continue iterating through each feature dataset...
OneFDName = TheFDNames.Next();
}
// now iterate through all the non-dataset feature classes...
TheFCNames = TheWrkspc.get_DatasetNames(esriDatasetType.esriDTFeatureClass);
OneFCName = TheFCNames.Next();
while (OneFCName != null)
{
// add each feature class name to the listbox
System.Array.Resize<String>(ref TheNames, TheNames.Length + 1);
TheNames[TheNames.Length - 1] = OneFCName.Name;
// ...and continue iterating...
OneFCName = TheFCNames.Next();
}
return TheNames;
}