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
TThe element type.
- Inheritance
-
XapiList<T>
- Implements
-
IEnumerable<T>IEquatable<XapiList<T>>
- 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
this[int]
Gets the element at the specified index in the read-only list.
public T this[int index] { get; }
Parameters
indexintThe 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
itemTThe 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
objobjectThe object to compare with the current object.
Returns
Equals(XapiList<T>?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(XapiList<T>? other)
Parameters
otherXapiList<T>An object to compare with this object.
Returns
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
Returns
operator !=(XapiList<T>?, XapiList<T>?)
Inequality operator.
public static bool operator !=(XapiList<T>? left, XapiList<T>? right)