Table of Contents

Class XapiList<T>

Namespace
Xapi
Assembly
Xapi.Core.dll

An immutable list with structural (element-by-element, ordered) equality, so that records holding lists compare by value.

public sealed class XapiList<T> : IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, IEquatable<XapiList<T>>

Type Parameters

T

The element type.

Inheritance
XapiList<T>
Implements
Inherited Members

Properties

Count

Gets the number of elements in the collection.

public int Count { get; }

Property Value

int

The number of elements in the collection.

Empty

The empty list.

public static XapiList<T> Empty { get; }

Property Value

XapiList<T>

IsEmpty

Whether the list has no elements.

public bool IsEmpty { get; }

Property Value

bool

this[int]

Gets the element at the specified index in the read-only list.

public T this[int index] { get; }

Parameters

index int

The zero-based index of the element to get.

Property Value

T

The element at the specified index in the read-only list.

Methods

Add(T)

Returns a new list with item appended.

public XapiList<T> Add(T item)

Parameters

item T

The element to append.

Returns

XapiList<T>

The new list.

Equals(object?)

Determines whether the specified object is equal to the current object.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

Equals(XapiList<T>?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(XapiList<T>? other)

Parameters

other XapiList<T>

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

GetEnumerator()

Returns a struct enumerator over the elements.

public XapiList<T>.Enumerator GetEnumerator()

Returns

XapiList<T>.Enumerator

The enumerator.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

ToString()

Returns the elements formatted as [a, b].

public override string ToString()

Returns

string

A diagnostic string.

Operators

operator ==(XapiList<T>?, XapiList<T>?)

Equality operator.

public static bool operator ==(XapiList<T>? left, XapiList<T>? right)

Parameters

left XapiList<T>

The first list.

right XapiList<T>

The second list.

Returns

bool

true when both lists hold equal elements in the same order.

operator !=(XapiList<T>?, XapiList<T>?)

Inequality operator.

public static bool operator !=(XapiList<T>? left, XapiList<T>? right)

Parameters

left XapiList<T>

The first list.

right XapiList<T>

The second list.

Returns

bool

true when the lists differ.