Udostępnij za pośrednictwem


VsEnumerable<TComEnumerator,TComEnumerated,TEnumerated>.CreateEnumerator Method

Definition

Create a new instance of derived class that is the COM-enumerator over the enumerated collection, starting from the specified enumerator position. Derived classes need to implement the following pattern:

  • create a private constructor with similar parameters as this function, calling the protected constructor in this base class with the same signature (collection/enumeratorPosition)
  • override the CreateEnumerator function and call the derived class' constructor with the 2 parameters
protected:
 abstract TComEnumerator CreateEnumerator(System::Collections::Generic::IEnumerable<TEnumerated> ^ collection, int enumeratorPosition);
protected abstract TComEnumerator CreateEnumerator (System.Collections.Generic.IEnumerable<TEnumerated> collection, int enumeratorPosition);
abstract member CreateEnumerator : seq<'Enumerated> * int -> 'ComEnumerator
Protected MustOverride Function CreateEnumerator (collection As IEnumerable(Of TEnumerated), enumeratorPosition As Integer) As TComEnumerator

Parameters

collection
IEnumerable<TEnumerated>

The collection to be enumerated

enumeratorPosition
Int32

The position of the created enumerator in the collection

Returns

TComEnumerator

An instance of the derived class implementing the enumerator

Remarks

Derived classes need to implement the following pattern:

  • Create a private constructor with similar parameters as this function, calling the protected constructor in this base class with the same signature (collection and enumeratorPosition).

    Override the CreateEnumerator method and call the derived class' constructor with the two parameters.

Applies to