AnsweredAssumed Answered

cursor slow

Question asked by mjk5000 on Jul 8, 2016
Latest reply on Jul 13, 2016 by mjk5000

I want to get all features from a feature class and add them to a list.  And I have noticed that the iteration using the cursor is just so slow.  Does anyone have a better way of getting all values back and populating a list with them.  I want the list of all features, but the loop is just so slow.  It is taking like 8 seconds to populate the list with 300 features

 

List<IFeature> featureList = new List<IFeature>();

 

//Run the filter on the Feature class and get the intersection

IFeatureCursor fc = featureClass.Search(null, false);

IFeature feature;

 

//SLOW PART STARTS HERE

while ((feature = fc.NextFeature()) != null)

{

    featureList.Add(feature);

}

Outcomes