Class RepeatedValueCollection<T>
Represents a collection that consists of the same repeated value the specified number of times.
public class RepeatedValueCollection<T> : IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable
Type Parameters
TThe type of the value contained in the repeated value collection.
- Inheritance
-
RepeatedValueCollection<T>
- Implements
-
IEnumerable<T>
- Inherited Members
- Extension Methods
Constructors
RepeatedValueCollection(T?, int)
Creates a new instance of the RepeatedValueCollection<T> class from the specified value and the count.
public RepeatedValueCollection(T? value, int count)
Parameters
valueTThe repeated value.
countintThe number of times the value is to be repeated.
Properties
Count
Gets or sets the number of times the specified value is to be repeated.
public int Count { get; set; }
Property Value
Value
The value that is contained multiple times.
public T? Value { get; }
Property Value
- T
Methods
GetEnumerator()
Gets the underlying enumerator instance that enumerates this collection by continuously returning the repeated element without exceeding the count.
public IEnumerator<T> GetEnumerator()
Returns
- IEnumerator<T>
The RepeatedValueCollection<T>.Enumerator instance that enumerates this collection.
ToArray()
Creates a new array and fills it with the same repeated value as many times as it's specified.
public T?[] ToArray()
Returns
- T[]
The new array that contains the repeated element.