Struct ReadOnlyCollectionView<TInput, TOutput>
Represents lazily converted read-only collection.
Implements
Inherited Members
Namespace: DotNext.Collections.Generic
Assembly: DotNext.dll
Syntax
public readonly struct ReadOnlyCollectionView<TInput, TOutput> : IReadOnlyCollection<TOutput>, IEnumerable<TOutput>, IEnumerable, IEquatable<ReadOnlyCollectionView<TInput, TOutput>>
Type Parameters
Name | Description |
---|---|
TInput | Type of items in the source collection. |
TOutput | Type of items in the converted collection. |
Remarks
Initializes a new lazily converted view.
Constructors
| Edit this page View SourceReadOnlyCollectionView(IReadOnlyCollection<TInput>, Converter<TInput, TOutput>)
Initializes a new lazily converted view.
Declaration
public ReadOnlyCollectionView(IReadOnlyCollection<TInput> collection, Converter<TInput, TOutput> mapper)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<TInput> | collection | Read-only collection to convert. |
Converter<TInput, TOutput> | mapper | Collection items converter. |
ReadOnlyCollectionView(IReadOnlyCollection<TInput>, Func<TInput, TOutput>)
Represents lazily converted read-only collection.
Declaration
public ReadOnlyCollectionView(IReadOnlyCollection<TInput> collection, Func<TInput, TOutput> mapper)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyCollection<TInput> | collection | Read-only collection to convert. |
Func<TInput, TOutput> | mapper | Collection items converter. |
Remarks
Initializes a new lazily converted view.
Properties
| Edit this page View SourceCount
Count of items in the collection.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceEquals(ReadOnlyCollectionView<TInput, TOutput>)
Determines whether two converted collections are same.
Declaration
public bool Equals(ReadOnlyCollectionView<TInput, TOutput> other)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyCollectionView<TInput, TOutput> | other | Other collection to compare. |
Returns
Type | Description |
---|---|
bool | true if this view wraps the same source collection and contains the same converter as other view; otherwise, false. |
Equals(object?)
Determines whether two converted collections are same.
Declaration
public override bool Equals(object? other)
Parameters
Type | Name | Description |
---|---|---|
object | other | Other collection to compare. |
Returns
Type | Description |
---|---|
bool | true if this view wraps the same source collection and contains the same converter as other view; otherwise, false. |
Overrides
| Edit this page View SourceGetEnumerator()
Returns enumerator over converted items.
Declaration
public IEnumerator<TOutput> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<TOutput> | The enumerator over converted items. |
GetHashCode()
Returns hash code for the this view.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | The hash code of this view. |
Overrides
Operators
| Edit this page View Sourceoperator ==(in ReadOnlyCollectionView<TInput, TOutput>, in ReadOnlyCollectionView<TInput, TOutput>)
Determines whether two collections are same.
Declaration
public static bool operator ==(in ReadOnlyCollectionView<TInput, TOutput> first, in ReadOnlyCollectionView<TInput, TOutput> second)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyCollectionView<TInput, TOutput> | first | The first collection to compare. |
ReadOnlyCollectionView<TInput, TOutput> | second | The second collection 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. |
operator !=(in ReadOnlyCollectionView<TInput, TOutput>, in ReadOnlyCollectionView<TInput, TOutput>)
Determines whether two collections are not same.
Declaration
public static bool operator !=(in ReadOnlyCollectionView<TInput, TOutput> first, in ReadOnlyCollectionView<TInput, TOutput> second)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyCollectionView<TInput, TOutput> | first | The first collection to compare. |
ReadOnlyCollectionView<TInput, TOutput> | second | The second collection 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. |