Class IndexedReplacement<T>
Namespace: AutoFixture.Idioms
Assembly: AutoFixture.Idioms.dll
Replaces an indexed element in a sequence with a given value.
public class IndexedReplacement<T> : IExpansion<T>Type Parameters
T
The type of the items in the sequences consumed and produced.
Inheritance
object ← IndexedReplacement<T>
Implements
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
IndexedReplacement(int, params T[])
Initializes a new instance of the IndexedReplacement%601 class.
public IndexedReplacement(int replacementIndex, params T[] source)Parameters
replacementIndex int
The index of the element which should be replaced.
source T[]
The sequence in which an element should be replaced.
Remarks
When `Expand(%600)` is invoked, the element at
replacementIndex in source will be replaced by
the new value. The index is zero-based.
See Also
IndexedReplacement<T>.Expand(T)
IndexedReplacement(int, IEnumerable<T>)
Initializes a new instance of the IndexedReplacement%601 class.
public IndexedReplacement(int replacementIndex, IEnumerable<T> source)Parameters
replacementIndex int
The index of the element which should be replaced.
source IEnumerable<T>
The sequence in which an element should be replaced.
Remarks
When `Expand(%600)` is invoked, the element at
replacementIndex in source will be replaced by
the new value. The index is zero-based.
See Also
IndexedReplacement<T>.Expand(T)
Properties
ReplacementIndex
Gets the index of the element which will be replaced by the Expand(%600)
method.
public int ReplacementIndex { get; }Property Value
Remarks
The index is zero-based.
Source
Gets the sequence of elements where one element will be replaced by the
Expand(%600) method.
public IEnumerable<T> Source { get; }Property Value
IEnumerable<T>
Methods
Expand(T)
Replaces the pre-selected element in the source sequence with a new element.
public IEnumerable<T> Expand(T value)Parameters
value T
The value which will replace the existing element.
Returns
IEnumerable<T>
A copy of Source where the pre-selected element has been replaced with
value.
Remarks
This method replaces an element in `Source` with
value. The element to be replaced is the element at the
`ReplacementIndex`. The replacement is not done directly in the
`Source`, but rather in a copy which is then returned by the method call.