There is no direct equivalent, but you can do it in two steps. First use Enumerable.Repeat
to create an array with the same value in each element. Then copy that over the destination array:
var t = Enumerable.Repeat(value, count).ToArray();
Array.Copy(t, 0, dest, destStartIndex, count);
For other destination containers there is a lack of an equivalent to Array.Copy
, but it is easy to add these as destinations, eg:
static void Overwrite<T>(this List<T> dest, IEnumerable<T> source, int destOffset) {
int pos = destOffset;
foreach (var val in source) {
// Could treat this as an error, or have explicit count
if (pos = dest.Length) { return; }
dest[pos++] = val;
}
}