Class Collection
Provides utility methods to work with collections.
Inherited Members
Namespace: DotNext.Collections.Generic
Assembly: DotNext.dll
Syntax
public static class Collection
Methods
| Improve this Doc View SourceAddAll<T>(ICollection<T>, IEnumerable<T>)
Adds multiple items into collection.
Declaration
public static void AddAll<T>(this ICollection<T> collection, IEnumerable<T> items)
Parameters
Type | Name | Description |
---|---|---|
ICollection<T> | collection | A collection to modify. |
IEnumerable<T> | items | An items to add into collection. |
Type Parameters
Name | Description |
---|---|
T | Type of collection items. |
Convert<TInput, TOutput>(IReadOnlyCollection<TInput>, ValueFunc<TInput, TOutput>)
Returns lazily converted read-only collection.
Declaration
public static ReadOnlyCollectionView<TInput, TOutput> Convert<TInput, TOutput>(this IReadOnlyCollection<TInput> collection, in ValueFunc<TInput, TOutput> converter)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<TInput> | collection | Read-only collection to convert. |
ValueFunc<TInput, TOutput> | converter | A collection item conversion function. |
Returns
Type | Description |
---|---|
ReadOnlyCollectionView<TInput, TOutput> | Lazily converted read-only collection. |
Type Parameters
Name | Description |
---|---|
TInput | Type of items in the source collection. |
TOutput | Type of items in the target collection. |
Convert<TInput, TOutput>(IReadOnlyCollection<TInput>, Converter<TInput, TOutput>)
Returns lazily converted read-only collection.
Declaration
public static ReadOnlyCollectionView<TInput, TOutput> Convert<TInput, TOutput>(this IReadOnlyCollection<TInput> collection, Converter<TInput, TOutput> converter)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<TInput> | collection | Read-only collection to convert. |
Converter<TInput, TOutput> | converter | A collection item conversion function. |
Returns
Type | Description |
---|---|
ReadOnlyCollectionView<TInput, TOutput> | Lazily converted read-only collection. |
Type Parameters
Name | Description |
---|---|
TInput | Type of items in the source collection. |
TOutput | Type of items in the target collection. |
ToArray<T>(ICollection<T>)
Converts collection into single-dimensional array.
Declaration
public static T[] ToArray<T>(ICollection<T> collection)
Parameters
Type | Name | Description |
---|---|---|
ICollection<T> | collection | A collection to convert. |
Returns
Type | Description |
---|---|
T[] | Array of collection items. |
Type Parameters
Name | Description |
---|---|
T | Type of collection items. |
ToArray<T>(IReadOnlyCollection<T>)
Converts read-only collection into single-dimensional array.
Declaration
public static T[] ToArray<T>(IReadOnlyCollection<T> collection)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<T> | collection | A collection to convert. |
Returns
Type | Description |
---|---|
T[] | Array of collection items. |
Type Parameters
Name | Description |
---|---|
T | Type of collection items. |