Implement Change Detection Drawing
This commit is contained in:
20
CoopSweeper/ArrayHelpers.cs
Normal file
20
CoopSweeper/ArrayHelpers.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CoopSweeper
|
||||
{
|
||||
public static class ArrayHelpers
|
||||
{
|
||||
public static T[,] Clone2D<T>(T[,] data) where T : 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user