DisposableCursor Class

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

Usage:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    ICursor rowCursor = table.Search(null, false);
    using (DisposableCursor dispCursor = new DisposableCursor(rowCursor))
    {
        IEnumerable<IRow> rows = dispCursor.AsEnumerable();
        foreach (IRow f in rows)
        {
            // perform your operation
        }
    }
    //Get a new instance of the cursor rowCursor2. You can't reuse the existing rowCursor.
    ICursor rowCursor2 = table.Search(null, false);
    using (DisposableCursor dispCursor = rowCursor2.ToDisposable())
    {
        IEnumerable<IRow> rows = dispCursor.AsEnumerable();
        int cnt = rows.Count();
    }

Constructors

NameDescription
DisposableCursor(ICursor)Initializes a DisposableCursor.

DisposableCursor(ICursor) Constructor

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

Use dark colors for code blocksCopy
1
public DisposableCursor(ICursor cursor)
Parameter nameTypeDescription
cursorICursorThe cursor to be made disposable.

Property

PropertyProperty valueDescription
DisposableCursor.FieldsIFieldsThe Fields Collection for this cursor. See ICursor.Fields

Methods

NameDescription
DisposableCursor.DisposeRelease the cursor explicitly to avoid leaking database resources.
DisposableCursor.DeleteRowDelete the existing Row in the database corresponding to the current position of the cursor.
DisposableCursor.FindField(String)Find the index of the field with the specified name.
DisposableCursor.FlushFlush any outstanding buffered writes to the database.
DisposableCursor.InsertRow(IRowBuffer)Insert a new Row into the database using the property values in the input buffer.
DisposableCursor.NextRowAdvance the position of the cursor by one and return the Row object at that position.
DisposableCursor.UpdateRow(IRow)Update the existing Row in the database corresponding to the current position of the cursor.

DisposableCursor.Dispose Method

Release the cursor to avoid leaking database resources.

Use dark colors for code blocksCopy
1
public void Dispose()

DisposableCursor.DeleteRow Method

Delete the existing Row in the database corresponding to the current position of the cursor. See ICursor.DeleteRow.

Use dark colors for code blocksCopy
1
public void DeleteRow()

DisposableCursor.FindField(String) Method

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

Use dark colors for code blocksCopy
1
public int FindField(string name)

DisposableCursor.Flush Method

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

Use dark colors for code blocksCopy
1
public void Flush()

DisposableCursor.InsertRow(IRowBuffer) Method

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

Use dark colors for code blocksCopy
1
public object InsertRow(IRowBuffer buffer)

DisposableCursor.NextRow Method

Advance the position of the cursor by one and return the Row object at that position. See ICursor.NextRow.

Use dark colors for code blocksCopy
1
public IRow NextRow()

DisposableCursor.UpdateRow(IRow) Method

Update the existing Row in the database corresponding to the current position of the cursor. See ICursor.UpdateRow.

Use dark colors for code blocksCopy
1
public void UpdateRow(IRow row)

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