//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.GameLogic;
///
/// Extensions for arrays.
///
public static class ArrayExtensions
{
///
/// Clears the elements of an array to the default values of the element type.
///
/// The array element type.
/// The array.
public static void ClearToDefaults(this T[] array)
{
for (int i = 0; i < array.Length; i++)
{
array[i] = default!;
}
}
///
/// Clears the elements of an array to the default values of the element type.
///
/// The array element type.
/// The array.
public static void ClearToDefaults(this T[,] array)
{
for (int i = 0; i < array.GetLength(0); i++)
{
for (int j = 0; j < array.GetLength(1); j++)
{
array[i, j] = default!;
}
}
}
}