Skip To Content

FeatureLayer.GetAttributes (.NET)

The FeatureLayer.GetAttributes method returns a collection of dictionaries of all the field names and values for all the features in the specified feature layer in the drawing. The collection includes a dictionary for each feature of the specified feature layer in the drawing. If a field value is provided, only the requested field will be returned.

Declaration

public IEnumerable<Dictionary<string, IConvertible>> Esri.ArcGISForAutoCAD.FeatureLayer.GetAttributes(Document doc, string flName, string sublayerName = null, string field = null)

Parameters

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

required

string

flName

An existing feature layer name in the drawing.

required

string

sublayerName

An existing feature sublayer name in the drawing.

optional

string

field

An existing feature layer field name in the drawing.

optional

Returns

TypeDescription

IEnumerable<Dictionary<string, IConvertible>>

A collection of dictionaries of all the attributes for all the features in the specified feature layer.

Remarks on error conditions

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

Example

Print all the attributes for the three features of the Shelters feature layer with the Open sublayer in the current drawing.

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

 // Get the attributes 
 var sheltersAttributes = Esri.ArcGISForAutoCAD.FeatureLayer.GetAttributes(doc, "Shelters", "Open");

 // Print the attributes 
 foreach (var dictionary in sheltersAttributes)
 {
   foreach (var attribute in dictionary)
   {
     doc.Editor.WriteMessage("\n{0}: {1}", attribute.Key, attribute.Value);
   }
 }

 /* Example output
 EntityHandle: 30C
 EntityType: POINT
 facname: ARLENE WELCH ELEMENTARY SCHOOL
 capacity: 609
 hoursoper: 8:30am-5:00pm
 sheltstat: Open
 EntityHandle: 2FD
 EntityType: POINT
 facname: OLIVER JULIAN KENDALL ELEM SCHOOL
 capacity: 656
 hoursoper: 8:30am-5:00pm
 sheltstat: Open
 EntityHandle: 2EE
 EntityType: POINT
 facname: CLIFFORD CRONE MIDDLE SCHOOL
 capacity: 093
 hoursoper: 6:00am-7:00pm
 sheltstat: Open
 */

See also

Attributes.Get—A .NET method that gets a dictionary of feature layer field names and their attribute values.

esri_featurelayer_getattributes—An AutoLISP function that gets the attributes of every feature in the feature layer.