private static void WriteOutputBack(IFeatureDataset theInFDataset, IFeatureDataset theOutFDataset) { //Debug.Print("Can delete " + theInFDataset.Name + "? " + theInFDataset.CanDelete()); //Debug.Print("Can rename " + theOutFDataset.Name + "? " + theOutFDataset.CanRename()); string origName = theInFDataset.Name; theInFDataset.Delete(); theOutFDataset.Rename(origName); IEnumDataset theEnumDS = theOutFDataset.Subsets; IDataset theDS = theEnumDS.Next(); while (theDS != null) { //Debug.Print("Need to rename " + theDS.Name); string theNewName = theDS.Name; while (theNewName.EndsWith("_1")) theNewName = theNewName.Substring(0, theNewName.Length - 2); theDS.Rename(theNewName); //Debug.Print("Renamed to " + theNewName); theDS = theEnumDS.Next(); } }