Class ICursorExtensions
- Namespace
- ESRI.Server.SOESupport
- Assembly
- ESRI.Server.SOESupport.dll
Provides LINQ-compatible enumeration and disposal extensions for ArcObjects cursors.
public static class ICursorExtensions
- Inheritance
-
ICursorExtensions
- Inherited Members
Methods
AsEnumerable(ICursor)
Convert the ArcObjects COM cursor to a .NET enumerable object.
public static IEnumerable<IRow> AsEnumerable(this ICursor source)
Parameters
sourceICursorThe cursor to enumerate.
Returns
- IEnumerable<IRow>
A forward-only sequence of rows.
Remarks
The enumerator returned is a forward-only cursor that can only be used once and cannot be reused.
Only one iteration via a foreach style loop or LINQ query operator, such as Count(), Where(), etc., is allowed.
To reuse the enumerator, obtain another cursor and call AsEnumerable again.
AsEnumerable(ICursor, bool)
Convert the ArcObjects COM cursor to a .NET enumerable object.
public static IEnumerable<IRow> AsEnumerable(this ICursor source, bool releaseAfterUse)
Parameters
sourceICursorThe cursor to enumerate.
releaseAfterUseboolSpecifies whether to release the COM cursor after use.
Returns
- IEnumerable<IRow>
A forward-only sequence of rows.
Remarks
The enumerator returned is a forward-only cursor that can only be used once and cannot be reused.
After it's iterated via a foreach style loop or LINQ query operator, such as Count(), Where(), etc.,
To reuse the enumerator, obtain another cursor and call AsEnumerable again.
The Cursor will be automatically released after the iteration when releaseAfterUse is true.
AsEnumerable(IFeatureCursor)
Convert the ArcObjects COM cursor to a .NET enumerable object.
public static IEnumerable<IFeature> AsEnumerable(this IFeatureCursor source)
Parameters
sourceIFeatureCursorThe feature cursor to enumerate.
Returns
- IEnumerable<IFeature>
A forward-only sequence of features.
Remarks
The enumerator returned is a forward-only cursor that can only be used once and cannot be reused.
Only one iteration via a foreach style loop or LINQ query operator, such as Count(), Where(), etc., is allowed.
To reuse the enumerator, obtain another feature cursor and call AsEnumerable again.
AsEnumerable(IFeatureCursor, bool)
Convert the ArcObjects COM cursor to a .NET enumerable object.
public static IEnumerable<IFeature> AsEnumerable(this IFeatureCursor source, bool releaseAfterUse)
Parameters
sourceIFeatureCursorThe feature cursor to enumerate.
releaseAfterUseboolSpecifies whether to release the COM cursor after use.
Returns
- IEnumerable<IFeature>
A forward-only sequence of features.
Remarks
The enumerator returned is a forward-only cursor that can only be used once and cannot be reused.
Only one iteration via a foreach style loop or LINQ query operator, such as Count(), Where(), etc., is allowed.
To reuse the enumerator, obtain another feature cursor and call AsEnumerable again.
The FeatureCursor will be automatically released after the iteration when releaseAfterUse is true.
ToDisposable(ICursor)
Wraps a cursor so it can be released through IDisposable.
public static DisposableCursor ToDisposable(this ICursor cursor)
Parameters
cursorICursorThe cursor to wrap.
Returns
- DisposableCursor
A disposable cursor wrapper.
ToDisposable(IFeatureCursor)
Wraps a feature cursor so it can be released through IDisposable.
public static DisposableFeatureCursor ToDisposable(this IFeatureCursor cursor)
Parameters
cursorIFeatureCursorThe feature cursor to wrap.
Returns
- DisposableFeatureCursor
A disposable feature cursor wrapper.