当前位置: 首页>>代码示例>>C#>>正文


C# IFeatureClass.DeleteField方法代码示例

本文整理汇总了C#中IFeatureClass.DeleteField方法的典型用法代码示例。如果您正苦于以下问题:C# IFeatureClass.DeleteField方法的具体用法?C# IFeatureClass.DeleteField怎么用?C# IFeatureClass.DeleteField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFeatureClass的用法示例。


在下文中一共展示了IFeatureClass.DeleteField方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TryDeleteAField

 private bool TryDeleteAField(IFeatureClass pFeatureClass, string pFieldName)
 {
     ISchemaLock tSchemaLock = (ISchemaLock)pFeatureClass;
     bool successful = false;
     try
     {
         tSchemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
         int tDeleteFieldNum = pFeatureClass.Fields.FindField(pFieldName);
         if (tDeleteFieldNum != -1)
         {
             IField tDeleteField = pFeatureClass.Fields.get_Field(tDeleteFieldNum);
             pFeatureClass.DeleteField(tDeleteField);
             successful = true;
         }
         else
         {
             logger.LogMessage(ServerLogger.msgType.debug, "DeleteAField", 8000,
                 "Couldn't find field requested for deletion: " + pFieldName + " from feature class!");
         }
     }
     catch (Exception ex)
     {
         logger.LogMessage(ServerLogger.msgType.debug, "DeleteAField", 8000,
                 "Couldn't delete field " + pFieldName + " from feature class! " + ex.Message);
     }
     finally
     {
         tSchemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
     }
     return successful;
 }
开发者ID:harry-gibson,项目名称:watershed-soe,代码行数:31,代码来源:WatershedSOE.cs

示例2: delteField

 public void delteField(IFeatureClass featureClass, string fldNm)
 {
     ISchemaLock schemaLock = (ISchemaLock)featureClass;
     try
     {
         // A try block is necessary, as an exclusive lock might not be available.
         schemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
         int fldIndex = featureClass.FindField(fldNm);
         featureClass.DeleteField(featureClass.Fields.get_Field(fldIndex));
     }
     catch (Exception exc)
     {
         // Handle appropriately for your application.
         Console.WriteLine(exc.Message);
         //MessageBox.Show(exc.Message);
     }
     finally
     {
         // Set the lock to shared, whether or not an error occurred.
         schemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
     }
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:22,代码来源:geodatabaseutility.cs


注:本文中的IFeatureClass.DeleteField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。