Ferrous API Reference

All Types / Ferrous.Results

class NonEmptyList<T>

public sealed class NonEmptyList<T> : IReadOnlyList<T>

An immutable, read-only list guaranteed to contain at least one element (Head).

Type Parameters
T
The element type.

Properties

public int Count

Methods

public static NonEmptyList<T> Create(T head, params T[] tail)

Creates a NonEmptyList<T> from a guaranteed head element and optional tail elements.

public static Option<NonEmptyList<T>> TryCreate(IEnumerable<T>? source)

Creates a NonEmptyList<T> if source contains at least one element; otherwise Option<T>.None.

public IEnumerator<T> GetEnumerator()