Show / Hide Table of Contents

Struct ReadOnlyListView<TInput, TOutput>

Represents lazily converted read-only list.

Implements
IReadOnlyList<TOutput>
IReadOnlyCollection<TOutput>
IEnumerable<TOutput>
IEnumerable
IEquatable<ReadOnlyListView<TInput, TOutput>>
Inherited Members
ValueType.ToString()
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: DotNext.Collections.Generic
Assembly: DotNext.dll
Syntax
public readonly struct ReadOnlyListView<TInput, TOutput> : IReadOnlyList<TOutput>, IReadOnlyCollection<TOutput>, IEnumerable<TOutput>, IEnumerable, IEquatable<ReadOnlyListView<TInput, TOutput>>
Type Parameters
Name Description
TInput

Type of items in the source list.

TOutput

Type of items in the converted list.

Remarks

Initializes a new lazily converted view.

Constructors

| Edit this page View Source

ReadOnlyListView(IReadOnlyList<TInput>, Converter<TInput, TOutput>)

Initializes a new lazily converted view.

Declaration
public ReadOnlyListView(IReadOnlyList<TInput> list, Converter<TInput, TOutput> mapper)
Parameters
Type Name Description
IReadOnlyList<TInput> list

Read-only list to convert.

Converter<TInput, TOutput> mapper

List items converter.

| Edit this page View Source

ReadOnlyListView(IReadOnlyList<TInput>, Func<TInput, TOutput>)

Represents lazily converted read-only list.

Declaration
public ReadOnlyListView(IReadOnlyList<TInput> list, Func<TInput, TOutput> mapper)
Parameters
Type Name Description
IReadOnlyList<TInput> list

Read-only list to convert.

Func<TInput, TOutput> mapper

List items converter.

Remarks

Initializes a new lazily converted view.

Properties

| Edit this page View Source

Count

Count of items in the list.

Declaration
public int Count { get; }
Property Value
Type Description
int
| Edit this page View Source

this[int]

Gets item at the specified position.

Declaration
public TOutput this[int index] { get; }
Parameters
Type Name Description
int index

Zero-based index of the item.

Property Value
Type Description
TOutput

Converted item at the specified position.

Exceptions
Type Condition
ArgumentOutOfRangeException

index is out of range.

Methods

| Edit this page View Source

Equals(ReadOnlyListView<TInput, TOutput>)

Determines whether two converted lists are same.

Declaration
public bool Equals(ReadOnlyListView<TInput, TOutput> other)
Parameters
Type Name Description
ReadOnlyListView<TInput, TOutput> other

Other list to compare.

Returns
Type Description
bool

true if this view wraps the same source list and contains the same converter as other view; otherwise, false.

| Edit this page View Source

Equals(object?)

Determines whether two converted lists are same.

Declaration
public override bool Equals(object? other)
Parameters
Type Name Description
object other

Other list to compare.

Returns
Type Description
bool

true if this collection wraps the same source collection and contains the same converter as other collection; otherwise, false.

Overrides
ValueType.Equals(object)
| Edit this page View Source

GetEnumerator()

Returns enumerator over converted items.

Declaration
public IEnumerator<TOutput> GetEnumerator()
Returns
Type Description
IEnumerator<TOutput>

The enumerator over converted items.

| Edit this page View Source

GetHashCode()

Returns hash code for the this list.

Declaration
public override int GetHashCode()
Returns
Type Description
int

The hash code of this list.

Overrides
ValueType.GetHashCode()

Operators

| Edit this page View Source

operator ==(in ReadOnlyListView<TInput, TOutput>, in ReadOnlyListView<TInput, TOutput>)

Determines whether two views are same.

Declaration
public static bool operator ==(in ReadOnlyListView<TInput, TOutput> first, in ReadOnlyListView<TInput, TOutput> second)
Parameters
Type Name Description
ReadOnlyListView<TInput, TOutput> first

The first list view to compare.

ReadOnlyListView<TInput, TOutput> second

The second list view to compare.

Returns
Type Description
bool

true if the first view wraps the same source collection and contains the same converter as the second view; otherwise, false.

| Edit this page View Source

operator !=(in ReadOnlyListView<TInput, TOutput>, in ReadOnlyListView<TInput, TOutput>)

Determines whether two views are not same.

Declaration
public static bool operator !=(in ReadOnlyListView<TInput, TOutput> first, in ReadOnlyListView<TInput, TOutput> second)
Parameters
Type Name Description
ReadOnlyListView<TInput, TOutput> first

The first list view to compare.

ReadOnlyListView<TInput, TOutput> second

The second list view to compare.

Returns
Type Description
bool

true if the first view wraps the different source collection and contains the different converter as the second view; otherwise, false.

Implements

IReadOnlyList<T>
IReadOnlyCollection<T>
IEnumerable<T>
IEnumerable
IEquatable<T>

Extension Methods

BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
Collection.ToAsyncEnumerator<TEnumerator, T>(TEnumerator, CancellationToken)
Collection.ToClassicEnumerator<TEnumerator, T>(TEnumerator)
Enumerator.Skip<TEnumerator, T>(ref TEnumerator, int)
ExpressionBuilder.Const<T>(T)
Collection.Append<T>(IEnumerable<T>, params T[])
Collection.Copy<T>(IEnumerable<T>, int, MemoryAllocator<T>?)
Collection.ElementAt<T>(IEnumerable<T>, int, out T)
Collection.FirstOrNone<T>(IEnumerable<T>)
Collection.ForEachAsync<T>(IEnumerable<T>, Func<T, CancellationToken, ValueTask>, CancellationToken)
Collection.ForEach<T>(IEnumerable<T>, Action<T>)
Collection.LastOrNone<T>(IEnumerable<T>)
Collection.Prepend<T>(IEnumerable<T>, params T[])
Collection.SequenceHashCode<T>(IEnumerable<T>, bool)
Collection.ToAsyncEnumerable<T>(IEnumerable<T>)
Collection.ToString<T>(IEnumerable<T>, string, string)
Enumerator.GetAsyncEnumerator<T>(IEnumerable<T>, CancellationToken)
Collection.Convert<TInput, TOutput>(IReadOnlyCollection<TInput>, Converter<TInput, TOutput>)
List.Convert<TInput, TOutput>(IReadOnlyList<TInput>, Converter<TInput, TOutput>)
List.IndexerGetter<T>(IReadOnlyList<T>)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾