Show / Hide Table of Contents

Class Collection

Provides utility methods to work with collections.

Inheritance
Object
Collection
Namespace: DotNext.Collections.Generic
Assembly: DotNext.dll
Syntax
public static class Collection : object

Methods

| Improve this Doc View Source

AddAll<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.

| Improve this Doc View Source

Convert<I, O>(IReadOnlyCollection<I>, Converter<I, O>)

Returns lazily converted read-only collection.

Declaration
public static ReadOnlyCollectionView<I, O> Convert<I, O>(this IReadOnlyCollection<I> collection, Converter<I, O> converter)
Parameters
Type Name Description
IReadOnlyCollection<I> collection

Read-only collection to convert.

DotNext.Converter<I, O> converter

A collection item conversion function.

Returns
Type Description
ReadOnlyCollectionView<I, O>

Lazily converted read-only collection.

Type Parameters
Name Description
I

Type of items in the source collection.

O

Type of items in the target collection.

| Improve this Doc View Source

Convert<I, O>(IReadOnlyCollection<I>, ValueFunc<I, O>)

Returns lazily converted read-only collection.

Declaration
public static ReadOnlyCollectionView<I, O> Convert<I, O>(this IReadOnlyCollection<I> collection, in ValueFunc<I, O> converter)
Parameters
Type Name Description
IReadOnlyCollection<I> collection

Read-only collection to convert.

ValueFunc<I, O> converter

A collection item conversion function.

Returns
Type Description
ReadOnlyCollectionView<I, O>

Lazily converted read-only collection.

Type Parameters
Name Description
I

Type of items in the source collection.

O

Type of items in the target collection.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX