Class ReadOnlyArray<T>
- Namespace
- GroupeIsa.Neos.Shared.Collections
- Assembly
- GroupeIsa.Neos.Shared.dll
Represents a readonly array.
[TypeConverter(typeof(ReadOnlyArrayConverter))]
public sealed class ReadOnlyArray<T> : IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable, IReadOnlyArray
Type Parameters
TType of array elements.
- Inheritance
-
ReadOnlyArray<T>
- Implements
-
IEnumerable<T>
- Inherited Members
- Extension Methods
Constructors
ReadOnlyArray()
Initializes a new instance of the ReadOnlyArray<T> class.
public ReadOnlyArray()
ReadOnlyArray(IEnumerable<T>)
Initializes a new instance of the ReadOnlyArray<T> class from the specified data source.
public ReadOnlyArray(IEnumerable<T> collection)
Parameters
collectionIEnumerable<T>An IEnumerable<T> that contains the data to copy.
ReadOnlyArray(params T[])
Initializes a new instance of the ReadOnlyArray<T> class from the specified array.
public ReadOnlyArray(params T[] collection)
Parameters
collectionT[]The Array that contains the data.
Properties
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.
Length
Gets the length of the array.
public int Length { get; }
Property Value
Methods
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
GetEnumerator()
Gets the element in the collection at the current position of the enumerator.
public IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
The element in the collection at the current position of the enumerator.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
IndexOf(T)
Searches for the specified item and returns the index of its first occurrence in the array.
public int IndexOf(T item)
Parameters
itemTThe item to locate in array.
Returns
- int
The index of the first occurrence of value in array, if found; otherwise, -1.
Operators
implicit operator T[](ReadOnlyArray<T>?)
Implicitly converts the specified readonly array to an array.
public static implicit operator T[](ReadOnlyArray<T>? readOnlyArray)
Parameters
readOnlyArrayReadOnlyArray<T>The ReadOnlyArray<T> to be converted.
Returns
- T[]
implicit operator ReadOnlyArray<T>(List<T>)
Defines an implicit conversion of a given ReadOnlyArray to a list.
public static implicit operator ReadOnlyArray<T>(List<T> list)
Parameters
listList<T>A list to implicitly convert.
Returns
implicit operator ReadOnlyArray<T>(T[])
Defines an implicit conversion of a given ReadOnlyArray to a array.
public static implicit operator ReadOnlyArray<T>(T[] array)
Parameters
arrayT[]A array to implicitly convert.