Class ImmutableValueArray<T>
- Namespace
- GuildWars2.Collections
- Assembly
- GuildWars2.dll
Represents an immutable array with value semantics, meaning two ImmutableValueArray<T> instances are considered equal if their contents are equal.
[JsonConverter(typeof(ImmutableValueArrayJsonConverterFactory))]
[SuppressMessage("Style", "IDE0028", Justification = "Cannot simplify constructor calls that wrap ImmutableArray<T>.")]
[SuppressMessage("Style", "IDE0301", Justification = "Cannot simplify to collection expression.")]
[SuppressMessage("Style", "IDE0303", Justification = "Cannot simplify to collection expression.")]
public sealed class ImmutableValueArray<T> : IImmutableValueList<T>, IImmutableList<T>, IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, IEquatable<IImmutableValueList<T>>, IEquatable<ImmutableValueArray<T>>
Type Parameters
TThe type of elements in the array.
- Inheritance
-
ImmutableValueArray<T>
- Implements
-
IEnumerable<T>
- Inherited Members
Remarks
This type wraps ImmutableArray<T> and is more memory-efficient than ImmutableValueList<T> for fixed-size collections.
Constructors
- ImmutableValueArray()
Initializes a new instance of the ImmutableValueArray<T> class that is empty.
- ImmutableValueArray(IEnumerable<T>)
Initializes a new instance of the ImmutableValueArray<T> class that contains elements copied from the specified collection.
Properties
- Empty
Gets an empty ImmutableValueArray<T>.
- Length
Gets the number of elements in the array.
Methods
- Add(T)
Creates a new ImmutableValueArray<T> with the specified item added to the end.
- AddRange(IEnumerable<T>)
Creates a new ImmutableValueArray<T> with the specified items added to the end.
- Clear()
Creates a new ImmutableValueArray<T> with all items removed.
- Contains(T)
Determines whether the array contains the specified item.
- Create(ReadOnlySpan<T>)
Creates an ImmutableValueArray<T> from a span of values. Used by collection expressions.
- Equals(IImmutableValueList<T>?)
Determines whether the current ImmutableValueArray<T> is equal to another IImmutableValueList<T> based on value semantics.
- Equals(ImmutableValueArray<T>?)
Determines whether the current ImmutableValueArray<T> is equal to another ImmutableValueArray<T> based on value semantics.
- GetHashCode()
Returns a hash code based on the values of the items in the array.
- IndexOf(T, int, int, IEqualityComparer<T>?)
Searches for the specified object and returns the zero-based index of the first occurrence within the range of elements in the IImmutableList<T> that starts at the specified index and contains the specified number of elements.
- Insert(int, T)
Creates a new ImmutableValueArray<T> with the specified item inserted at the specified index.
- InsertRange(int, IEnumerable<T>)
Creates a new ImmutableValueArray<T> with the specified items inserted at the specified index.
- LastIndexOf(T, int, int, IEqualityComparer<T>?)
Searches for the specified object and returns the zero-based index of the last occurrence within the range of elements in the IImmutableList<T> that contains the specified number of elements and ends at the specified index.
- Remove(T, IEqualityComparer<T>?)
Creates a new ImmutableValueArray<T> with the first occurrence of the specified item removed.
- RemoveAll(Predicate<T>)
Creates a new ImmutableValueArray<T> with all items that match the specified predicate removed.
- RemoveAt(int)
Creates a new ImmutableValueArray<T> with the item at the specified index removed.
- RemoveRange(IEnumerable<T>, IEqualityComparer<T>?)
Creates a new ImmutableValueArray<T> with the specified items removed.
- RemoveRange(int, int)
Creates a new ImmutableValueArray<T> with a range of items removed.
- Replace(T, T, IEqualityComparer<T>?)
Creates a new ImmutableValueArray<T> with the first occurrence of the old value replaced with the new value.
- SetItem(int, T)
Creates a new ImmutableValueArray<T> with the element at the specified index replaced.
Operators
- operator ==(ImmutableValueArray<T>?, ImmutableValueArray<T>?)
Determines whether two ImmutableValueArray<T> instances are equal by value.
- operator !=(ImmutableValueArray<T>?, ImmutableValueArray<T>?)
Determines whether two ImmutableValueArray<T> instances are not equal by value.