Grouping

Namespace: SnowBank.Collections.Generic · class

Methods

Create

static Grouping<TKey, TElement> Create<TKey, TElement>(IGrouping<TKey, TElement> grouping)

Creates a new grouping from an existing IGrouping

static Grouping<TKey, TElement> Create<TKey, TElement>(TKey key, TElement element)

Create a new grouping that contains a single element

  • key — Key for this grouping
  • element — Single element that will be stored in the grouping

static Grouping<TKey, TElement> Create<TKey, TElement>(TKey key, params TElement[] elements)

Creates a new grouping from an already allocated array of elements

  • key — Key for this grouping
  • elements — Array of elements that will be stored in the grouping

The grouping will use the specified array as the backing store. This array should not be modified or returned into a pool, as long as the grouping is used!

static Grouping<TKey, TElement> Create<TKey, TElement>(TKey key, ICollection<TElement> elements)

Creates a new grouping from a collection of elements

  • key — Key for this grouping
  • elements — Collection of elements that will be stored in the grouping

static Grouping<TKey, TElement> Create<TKey, TElement>(TKey key, IEnumerable<TElement> elements)

Creates a new grouping from a sequence of elements

  • key — Key for this grouping
  • elements — Sequence of elements that will be stored in the grouping

FromLinq

static Grouping<TKey, TElement> FromLinq<TKey, TElement>(IGrouping<TKey, TElement> grouping)

Converts from a LINQ grouping

FromPair

static Grouping<TKey, TElement> FromPair<TKey, TElement>(KeyValuePair<TKey, TElement> pair)

Creates a new grouping from a key/value pair singleton

static Grouping<TKey, TElement> FromPair<TKey, TElement>(KeyValuePair<TKey, TElement[]> pair)

Creates a new grouping from a key/values pair

static Grouping<TKey, TElement> FromPair<TKey, TElement>(KeyValuePair<TKey, ICollection<TElement>> pair)

Creates a new grouping from a key/values pair

static Grouping<TKey, TElement> FromPair<TKey, TElement>(KeyValuePair<TKey, IEnumerable<TElement>> pair)

Creates a new grouping from a key/values pair