21 lines
577 B
C#
21 lines
577 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace CoopSweeper
|
|
{
|
|
public static class ArrayHelpers
|
|
{
|
|
public static T[,] Clone2D<T>(T[,] data) where T : class, ICloneable<T>
|
|
{
|
|
if (data == null)
|
|
return null;
|
|
var newArray = new T[data.GetLength(0), data.GetLength(1)];
|
|
for (var x = 0; x< data.GetLength(0); x++)
|
|
for (var y = 0; y < data.GetLength(1); y++)
|
|
newArray[x,y] = data[x,y].Clone();
|
|
return newArray;
|
|
}
|
|
}
|
|
}
|