Skip To Content

Attributes.UniqueValues (.NET)

此方法可返回指定字段的唯一值的集合。

声明

public IEnumerable<IConvertible> Esri.ArcGISForAutoCAD.Attributes.UniqueValues(Document doc, string flName, string fieldName, string sublayerName = null)

参数

类型名称描述必填

文档

doc

要进行操作的 AutoCAD 文档。

必填

string

flName

工程图中现有的要素图层名称。

必填

string

fieldName

要素图层中的现有字段名称。

必填

string

sublayerName

工程图中现有的要素图层子图层名称。

可选

返回

类型描述

IEnumerable<IConvertible>

与指定字段类型具有相同类型的唯一值的集合。

错误条件备注

如果参数无效,则此方法可能会抛出异常或者返回 null

示例

打印 USA_States_Generalized(无子类型)要素图层的 SUB_REGION 字段中的唯一值:

// Initialize 
var doc = Application.DocumentManager.MdiActiveDocument;

// Gather the unique attribute values
var uniqueSubRegions = Esri.ArcGISForAutoCAD.Attributes.UniqueValues(doc, "USA_States_Generalized", "SUB_REGION");

// Print the unique attribute values
foreach (var uVal in uniqueSubRegions)
{
  doc.Editor.WriteMessage("\n" + uVal);
}

/* Example output 
Pacific
Mountain
West South Central
West North Central
East South Central
New England
South Atlantic
East North Central
Middle Atlantic
*/

另请参阅

esri_attributes_uniquevalues - 此 AutoLISP 函数可返回指定字段的唯一值列表。