diff --git a/X10D/src/Collections/ArrayExtensions.cs b/X10D/src/Collections/ArrayExtensions.cs index a6db95e..32e094b 100644 --- a/X10D/src/Collections/ArrayExtensions.cs +++ b/X10D/src/Collections/ArrayExtensions.cs @@ -87,28 +87,6 @@ public static class ArrayExtensions Array.Clear(array, index, length); } - /// - /// Assigns the given value to each element of the array. - /// - /// The array to be filled. - /// The value to assign to each array element. - /// The type of the elements in the array. - /// is . - public static void Fill(this T?[] array, T value) - { - if (array is null) - { - throw new ArgumentNullException(nameof(array)); - } - - if (array.Length == 0) - { - return; - } - - Array.Fill(array, value); - } - /// /// Assigns the given value to the elements of the array which are within the range of /// (inclusive) and the next number of indices. diff --git a/X10D/src/Collections/ListExtensions.cs b/X10D/src/Collections/ListExtensions.cs index 7fb8ce4..1444287 100644 --- a/X10D/src/Collections/ListExtensions.cs +++ b/X10D/src/Collections/ListExtensions.cs @@ -5,6 +5,26 @@ /// public static class ListExtensions { + /// + /// Assigns the given value to each element of the list. + /// + /// The list to be filled. + /// The value to assign to each list element. + /// The type of the elements in the list. + /// is . + public static void Fill(this IList source, T value) + { + if (source is null) + { + throw new ArgumentNullException(nameof(source)); + } + + for (var i = 0; i < source.Count; i++) + { + source[i] = value; + } + } + /// /// Returns a random element from the current list using a specified instance. ///