How can I get the feature count of a layer?

2843
2
Jump to solution
12-08-2017 12:32 AM
TomGeo
by
Frequent Contributor

I have to write an add-in for our technicians where in a dockpane I want to show the total amount of features in the layer. So far I only found how to get the count of selected features, but that doesn't help me, since I don't want to run a 'select all' every time there is something going on at the side of our technicians.

In Python there is a getCount method. Is this function available in C# as well.

Bests Thomas

- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi Thomas,

FeatureClass has method GetCount().

                            FeatureClass pFeatClass = featLayer.GetFeatureClass();
                            int nCount = pFeatClass.GetCount();

View solution in original post

0 Kudos
2 Replies
GKmieliauskas
Esri Regular Contributor

Hi Thomas,

FeatureClass has method GetCount().

                            FeatureClass pFeatClass = featLayer.GetFeatureClass();
                            int nCount = pFeatClass.GetCount();
0 Kudos
MK13
by
Frequent Contributor

@GKmieliauskas what if you want to count the records after setting a definition query? Is there a way to get that count without setting a selection?

0 Kudos