Interface IPersistentList<T>
Represents an IList<T> which is persisted to a backing store.
Inherited Members
Namespace: Couchbase.DataStructures
Assembly: Couchbase.NetClient.dll
Syntax
public interface IPersistentList<T> : ICollection, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, IAsyncEnumerable<T>
Type Parameters
| Name | Description |
|---|---|
| T | Type of value in the set. |
Remarks
If using a SystemTextJsonSerializer backed by a JsonSerializerContext, be sure to include IList<T> in a JsonSerializableAttribute on the context. Note that a reference comparision is used by default. If you load the list and try to use an item out of it to remove from the list, it will return false unless Object.Equals() is overridden on the item's class as the document is reloaded from the database and therefore cannot be used for reference equality. Note that .NET Records override Equals implicitly.
Properties
| Edit this page View SourceCountAsync
Counts the items in the list.
Declaration
Task<int> CountAsync { get; }
Property Value
| Type | Description |
|---|---|
| Task<int> | A Task<TResult> for awaiting. The value is the number of items in the list. |
Methods
| Edit this page View SourceAddAsync(T)
Adds an item into the document.
Declaration
Task AddAsync(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | The item to add. |
Returns
| Type | Description |
|---|---|
| Task | A Task for awaiting. |
Remarks
Override Object.Equals if using POCOs; .NET Records do so implicitly.
ClearAsync()
Clears the document.
Declaration
Task ClearAsync()
Returns
| Type | Description |
|---|---|
| Task | A Task for awaiting. |
ContainsAsync(T)
Checks to see if the document contains an item.
Declaration
Task<bool> ContainsAsync(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | The item |
Returns
| Type | Description |
|---|---|
| Task<bool> | A Task<TResult> for awaiting. True if the item exists, otherwise false. |
Remarks
Override Object.Equals if using POCOs; .NET Records do so implicitly.
CopyToAsync(Array, int)
Copies an items into an array starting at an index.
Declaration
Task CopyToAsync(Array array, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| Array | array | The array of items to add to the document. |
| int | index | The starting index. |
Returns
| Type | Description |
|---|---|
| Task |
CopyToAsync(T[], int)
Copies an array into the document.
Declaration
Task CopyToAsync(T[] array, int arrayIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| T[] | array | The array of items to add to the document. |
| int | arrayIndex | The starting index. |
Returns
| Type | Description |
|---|---|
| Task | A Task for awaiting. |
IndexOfAsync(T)
Returns the index of item in the list.
Declaration
Task<int> IndexOfAsync(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | An item which should have Object.Equals() overridden. |
Returns
| Type | Description |
|---|---|
| Task<int> | A Task<TResult> for awaiting. The value is the index of item in the list. |
Remarks
Override Object.Equals if using POCOs; .NET Records do so implicitly.
InsertAsync(int, T)
Inserts an item into the list.
Declaration
Task InsertAsync(int index, T item)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The starting index. |
| T | item | An item which should have Object.Equals() overridden. |
Returns
| Type | Description |
|---|---|
| Task |
Remarks
Override Object.Equals if using POCOs; .NET Records do so implicitly.
RemoveAsync(T)
Attempts to remove an item from the list.
Declaration
Task<bool> RemoveAsync(T item)
Parameters
| Type | Name | Description |
|---|---|---|
| T | item | An item which should have Object.Equals() overridden. |
Returns
| Type | Description |
|---|---|
| Task<bool> | True if the item is found and removed; otherwise false. |
Remarks
Override Object.Equals if using POCOs; .NET Records do so implicitly.
RemoveAtAsync(int)
Removes an item item from the list.
Declaration
Task RemoveAtAsync(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | The starting index. |
Returns
| Type | Description |
|---|---|
| Task | A Task for awaiting." |
Remarks
Override Object.Equals if using POCOs; .NET Records do so implicitly.