first method

IIterator<T> first()

Returns an iterator for the items in the collection.

Implementation

IIterator<T> first() {
  final retValuePtr = calloc<COMObject>();

  final hr = ptr.ref.lpVtbl.value
          .elementAt(6)
          .cast<
              Pointer<
                  NativeFunction<
                      HRESULT Function(Pointer, Pointer<COMObject>)>>>()
          .value
          .asFunction<int Function(Pointer, Pointer<COMObject>)>()(
      ptr.ref.lpVtbl, retValuePtr);

  if (FAILED(hr)) {
    free(retValuePtr);
    throw WindowsException(hr);
  }

  return IIterator.fromRawPointer(
    retValuePtr,
    creator: _creator,
    enumCreator: _enumCreator,
    intType: _intType,
  );
}