20 lines
449 B
C#
20 lines
449 B
C#
using System;
|
|
namespace Gameboard.ShogiUI.BoardState
|
|
{
|
|
public static class Extensions
|
|
{
|
|
public static void ForEachNotNull(this Piece[,] array, Action<Piece, int, int> action)
|
|
{
|
|
for (var x = 0; x < array.GetLength(0); x++)
|
|
for (var y = 0; y < array.GetLength(1); y++)
|
|
{
|
|
var piece = array[x, y];
|
|
if (piece != null)
|
|
{
|
|
action(piece, x, y);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|