---
title: clsTaskCollection
summary: API reference for clsTaskCollection.
status: draft
owner: SAIF
last_reviewed: 2026-07-24
library: SAIF.Business.Tasks
reference_type: package
---

# clsTaskCollection

Abstract BOF collection that retrieves, creates, saves, and purges typed task objects.

## Purpose
- Provide the reusable collection wrapper for task search, edit, and purge scenarios.
- Own the nested criteria type that assembles the dynamic task query.

## Context
- Namespace: `SAIF.Business.Tasks`
- Assembly/package: `SAIF.BOF.Business.Tasks`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| Item(Index) | `Default ReadOnly Property(ByVal Index As Integer) As iTask` | Return the task at the supplied collection index. |
| Item(inTaskSeqNum) | `Default ReadOnly Property(ByVal inTaskSeqNum As String) As iTask` | Return the task matching the supplied task sequence number string. |
| MyCriteria | `ReadOnly Property As Criteria` | Expose the criteria object used to build the collection query. |
| Contains(inTask) | `Overloads Function(ByVal inTask As iTask) As Boolean` | Report whether the live collection contains the supplied task. |
| Contains(inTaskSeqNum) | `Overloads Function(ByVal inTaskSeqNum As Decimal) As Boolean` | Report whether the live collection contains the supplied task sequence number. |
| ContainsDeleted(inTask) | `Overloads Function(ByVal inTask As iTask) As Boolean` | Report whether the deleted-item list contains the supplied task. |
| ContainsDeleted(inTaskSeqNum) | `Overloads Function(ByVal inTaskSeqNum As Decimal) As Boolean` | Report whether the deleted-item list contains the supplied task sequence number. |
| Add(inTask) | `Overloads Function(ByVal inTask As iTask) As Integer` | Add a task to the collection through the BOF base implementation. |
| Remove(inTask) | `Sub(ByVal inTask As iTask)` | Remove the supplied task instance from the live collection. |
| Remove(inTaskSeqNum) | `Sub(ByVal inTaskSeqNum As Decimal)` | Remove the first task whose `TaskSeqNum` matches the supplied value. |
| Save() | `Overrides Function As Boolean` | Apply collection edits and persist them through the BOF save lifecycle. |
| GetTasks(inDataPortalInfo, inSelectionCriteria) | `Shared Function(ByVal inDataPortalInfo As IDataPortalInfo, ByVal inSelectionCriteria As Criteria) As clsTaskCollection` | Retrieve a filtered task collection. |
| NewTask() | `MustOverride Function As iTask` | Return the concrete task type used for collection materialization. |
| PurgeTasks(inDataPortalInfo, inTaskSourceCode, inTaskCategoryCode, inKeepDays) | `Shared Function(ByVal inDataPortalInfo As IDataPortalInfo, ByVal inTaskSourceCode As String, ByVal inTaskCategoryCode As String, ByVal inKeepDays As String) As Integer` | Invoke `PK82036_Task.Task_Purge` and return the deleted-row count. |

## Behavioral notes
- Uses the nested `Criteria` type to shape the collection-retrieval `SELECT` documented by [SQL-008](../../sql/SQL-008-task-filtered-collection-select.md).
- Dispatches each reader row to `NewTask()` during collection materialization.
- Purge behavior maps to [BR-021](../../business-rules.md#br-021-task-purge-is-limited-to-deleted-rows-in-the-requested-source-and-category-slice) and [BR-022](../../business-rules.md#br-022-task-purge-retention-is-enforced-by-whole-day-age).

## Constraints and usage notes
- Concrete subclasses must implement `NewTask()` before the collection can materialize typed task instances.

## Sources
- `Business\SAIF.Business.Tasks\clsTaskCollection.vb`
