DisposableFeatureCursor Class

Wrapper class of a disposable IFeatureCursor which will automatically release the IFeatureCursor after the cursor is used.

Usage:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    IFeatureCursor featureCursor = featureClass.Search(null, false);
    using (DisposableFeatureCursor dispCursor = new DisposableFeatureCursor(featureCursor))
    {
        IEnumerable<IFeature> features = dispCursor.AsEnumerable();
        foreach (IFeature f in features)
        {
            // perform your operation
        }
    }
    //Get a new instance of the cursor featureCursor2. You can't reuse the existing featureCursor.
    IFeatureCursor featureCursor2 = featureClass.Search(null, false);
    using (DisposableFeatureCursor dispCursor2 = featureCursor2.ToDisposable())
    {
        IEnumerable<IFeature> features = dispCursor2.AsEnumerable();
        int cnt = features.Count();
    }

Constructors

NameDescription
DisposableFeatureCursor(IFeatureCursor)Initializes a DisposableFeatureCursor.

DisposableFeatureCursor(IFeatureCursor) Constructor

Creates a DisposableFeatureCursor from IFeatureCursor object. Note that a DisposableFeatureCursor cannot be wrapped or instantiated in another DisposableFeatureCursor instance, otherwise, an ArgumentException "Unable to wrap DisposableFeatureCursor in another DisposableFeatureCursor instance." will be thfeaturen by the constructor.

1
public DisposableFeatureCursor(IFeatureCursor cursor)
Parameter nameTypeDescription
cursorIFeatureCursorThe cursor to be made disposable.

Property

PropertyProperty valueDescription
DisposableFeatureCursor.FieldsIFieldsThe Fields Collection for this cursor. See IFeatureCursor.Fields

Methods

NameDescription
DisposableFeatureCursor.DisposeRelease the cursor explicitly to avoid leaking database resources.
DisposableFeatureCursor.DeleteFeatureDelete the existing Feature in the database corresponding to the current position of the cursor.
DisposableFeatureCursor.FindField(String)Find the index of the field with the specified name.
DisposableFeatureCursor.FlushFlush any outstanding buffered writes to the database.
DisposableFeatureCursor.InsertFeature(IFeatureBuffer)Insert a new Feature into the database using the property values in the input buffer.
DisposableFeatureCursor.NextFeatureAdvance the position of the cursor by one and return the Feature object at that position.
DisposableFeatureCursor.UpdateFeature(IFeature)Update the existing Feature in the database corresponding to the current position of the cursor.

DisposableFeatureCursor.Dispose Method

Release the cursor to avoid leaking database resources.

1
public void Dispose()

DisposableFeatureCursor.DeleteFeature Method

Delete the existing Feature in the database corresponding to the current position of the cursor. See IFeatureCursor.DeleteFeature.

1
public void DeleteFeature()

DisposableFeatureCursor.FindField(String) Method

Find the index of the field with the specified name. See IFeatureCursor.FindField.

1
public int FindField(string name)

DisposableFeatureCursor.Flush Method

Flush any outstanding buffered writes to the database. See IFeatureCursor.Flush.

1
public void Flush()

DisposableFeatureCursor.InsertFeature(IFeatureBuffer) Method

Insert a new Feature into the database using the property values in the input buffer. The object ID of the new Feature, if there is one, is returned. See IFeatureCursor.InsertFeature.

1
public object InsertFeature(IFeatureBuffer buffer)

DisposableFeatureCursor.NextFeature Method

Advance the position of the cursor by one and return the Feature object at that position. See IFeatureCursor.NextFeature.

1
public IFeature NextFeature()

DisposableFeatureCursor.UpdateFeature(IFeature) Method

Update the existing Feature in the database corresponding to the current position of the cursor. See IFeatureCursor.UpdateFeature.

1
public void UpdateFeature(IFeature feature)

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close