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
T
Type of array elements.
- Inheritance
-
ReadOnlyArray<T>
- Implements
-
IEnumerable<T>
- Inherited Members
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
collection
IEnumerable<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
collection
T[]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
index
intThe 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
obj
objectThe 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
item
TThe 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
readOnlyArray
ReadOnlyArray<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
list
List<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
array
T[]A array to implicitly convert.