[C#]
publicIObjectClass CreateObjectClass_Example(IWorkspace2 workspace, String nameOfObjectClass, IFields fields,stringconfigKeyword) { IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;if(workspace.get_NameExists(esriDatasetType.esriDTTable, nameOfObjectClass)) {// If table with that name already exists, return that table.return(IObjectClass)featureWorkspace.OpenTable(nameOfObjectClass); }// Create an object class description to use if needed for fields collection and for the CLSID parameter.IObjectClassDescription ocDesc =newObjectClassDescription();// If no field collection is supplied, create one using the IObjectClassDescription.if(fields ==null) {//Get the set of required fields collection.fields = ocDesc.RequiredFields; }return(IObjectClass) featureWorkspace.CreateTable(nameOfObjectClass, fields, ocDesc.InstanceCLSID, ocDesc.ClassExtensionCLSID, configKeyword); }

本文介绍了一个C#示例,展示了如何使用ArcGIS API创建或打开一个已存在的表格对象类。如果指定名称的表格已存在,则直接返回该表格;若不存在,则创建新的表格,并设置其字段集合和类标识。
707

被折叠的 条评论
为什么被折叠?



