Class Cores
Extension methods for generic operations on core members.
Inherited Members
Namespace: StrixMusic.Sdk.Extensions
Assembly: StrixMusic.Sdk.dll
Syntax
public static class Cores
Methods
| Improve this Doc View SourceGetItems<TCollection, TResult>(ICoreCollection, int, int)
Gets items from a specific collection type in an object that derives multiple collection types.
Declaration
public static IAsyncEnumerable<TResult> GetItems<TCollection, TResult>(this ICoreCollection source, int limit, int offset) where TCollection : ICoreModel, ICollectionBase
Parameters
Type | Name | Description |
---|---|---|
ICoreCollection | source | The source collection. |
int | limit | The max number of items to return. |
int | offset | Get items starting at this index. |
Returns
Type | Description |
---|---|
IAsyncEnumerable<TResult> | An IAsyncEnumerable<T> of the requested items. |
Type Parameters
Name | Description |
---|---|
TCollection | The type of the collection we're handling. |
TResult | The type of the returned items. |
GetItemsCount<TCollection>(ICoreModel)
Gets the total items count from an ICoreModel by casting it to the specified collection type.
Declaration
public static int GetItemsCount<TCollection>(this ICoreModel source) where TCollection : ICollectionBase
Parameters
Type | Name | Description |
---|---|---|
ICoreModel | source |
Returns
Type | Description |
---|---|
int | The number of items for the given collection. |
Type Parameters
Name | Description |
---|---|
TCollection | The collection type to check the item count. |
IsAddAvailable<TCollection>(TCollection, int, CancellationToken)
Checks a collection for support for adding an item at a specific index.
Declaration
public static Task<bool> IsAddAvailable<TCollection>(this TCollection source, int index, CancellationToken cancellationToken = default) where TCollection : ICoreCollection
Parameters
Type | Name | Description |
---|---|---|
TCollection | source | The source collection. |
int | index | The index to check. |
CancellationToken | cancellationToken | A cancellation token that may be used to cancel the ongoing task. |
Returns
Type | Description |
---|---|
Task<bool> | A Task representing the asynchronous operation. Value indicates support. |
Type Parameters
Name | Description |
---|---|
TCollection | The type of collection. |
IsRemoveAvailable<TCollection>(TCollection, int, CancellationToken)
Checks a collection for support for adding an item at a specific index.
Declaration
public static Task<bool> IsRemoveAvailable<TCollection>(this TCollection source, int index, CancellationToken cancellationToken = default) where TCollection : class, ICollectionBase, ICoreModel
Parameters
Type | Name | Description |
---|---|---|
TCollection | source | The source collection. |
int | index | The index to check. |
CancellationToken | cancellationToken | A cancellation token that may be used to cancel the ongoing task. |
Returns
Type | Description |
---|---|
Task<bool> | A Task representing the asynchronous operation. Value indicates support. |
Type Parameters
Name | Description |
---|---|
TCollection | The type of collection. |