Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When we search within a feature class, it returns a feature cursor. To get features from a feature cursor, I use following code snippet:

private List<IFeature> GetFeatureList(IFeatureCursor featureCursor)
    var features = new List<IFeature>();
    IFeature feature;
    while ((feature = featureCursor.NextFeature()) != null)
    return features;

But problem is for some interfaces and methods, we need this featurecursor. But before passing this feature cursor to that method, I have already traverse it. So, using IFeatureCursor.NextFeature method, I don't get any other feature here. Is there any method or interface or anything that can reset the feature cursor and make the feature cursor re-usable?

share|improve this question
up vote 2 down vote accepted

From the help on ICursor:

Cursors are forward only; they do not support backing up and retrieving rows that have already been retrieved or making multiple passes over data. If an application needs to make multiple passes over the data, the application needs to reexecute the query that returned the cursor.

You really shouldn't be passing around cursors though, IMO. Consider implementing a repository pattern that abstracts the data access layer so instead of passing around a feature cursor, you access the repository which handles the ArcObjects-level code.

See also:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.