I'm creating a new feature class with the attribute table schema (field names, types etc.) copied from another feature class. Then, I'd like to modify this schema slightly (e.g. add an additional field).
What is the best way to achieve this? Should I loop through all input fields and create respective output fields?
Thanks in advance,
Jan
Best Answer
I'd consider leveraging IFieldChecker. There's some sample code under the Creating output feature class fields and geometry section on this page.
Also, if you need to keep track of which destination fields were derived from which origin fields, you might consider using IModelInfo:
If you just need to add a field, the simplest is probably calling IClone.Clone() on the origin featureclass's IFeatureClass.Fields member, then using IFieldsEdit.AddField on the resulting clone to add the single field, then using that to create the new featureclass.