private void AddField(IFeatureClass pFeatureClass, string name, string aliasName, esriFieldType FieldType)
        {
            //若存在,则不需添加
            if(pFeatureClass.Fields.FindField(name) > -1) return ;
            IField pField = new FieldClass();
            IFieldEdit pFieldEdit = pField as IFieldEdit;
            pFieldEdit.AliasName_2 = aliasName;
            pFieldEdit.Name_2 = name;
            pFieldEdit.Type_2 = FieldType;

            IClass pClass = pFeatureClass as IClass;
            pClass.AddField(pField);
        }

在现有表中添加字段,需要用到  IField , IFieldEdit, IFeatureClass,

其中IFieldEdit主要是用于创建IField相关信息,包括name、type等;

IClass 则用于向表中插入新的字段 pClass.AddField(pField);

相关文章:

  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-12-27
  • 2021-11-14
猜你喜欢
  • 2021-11-28
  • 2021-08-27
  • 2021-11-18
  • 2021-09-17
  • 2021-08-15
  • 2022-02-02
  • 2022-01-27
相关资源
相似解决方案