Skip To Content

Attributes.UniqueValues (.NET)

This method returns a collection of unique values for a specified field.

Declaration

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

Parameters

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

required

string

flName

An existing feature layer name in the drawing.

required

string

fieldName

An existing field name from the feature layer.

required

string

sublayerName

An existing feature layer sublayer name in the drawing.

optional

Returns

TypeDescription

IEnumerable<IConvertible>

A collection of unique values of the same type as the specified field type.

Remarks on error conditions

This method may throw an exception or return null if a parameter is invalid.

Example

Print the unique values from the SUB_REGION field of the USA_States_Generalized (no sublayer) feature layer.

// 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
*/

See also

esri_attributes_uniquevalues—An AutoLISP function that returns a list of the unique values for a specified field.