-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfe972d
commit 32d8b25
Showing
2 changed files
with
29 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
|
||
namespace ProjectEuler.Problems.Helpers | ||
{ | ||
public class Grid<T> | ||
{ | ||
public T[,] Values { get; } | ||
|
||
public T this[int col, int row] | ||
{ | ||
get => Values[col, row]; | ||
set => Values[col, row] = value; | ||
} | ||
|
||
public int ColCount { get; } | ||
public int RowCount { get; } | ||
|
||
public Grid(int colCount, int rowCount) | ||
{ | ||
if (colCount < 1 || rowCount < 1) | ||
throw new ArgumentOutOfRangeException(); | ||
|
||
ColCount = colCount; | ||
RowCount = rowCount; | ||
Values = new T[ColCount, RowCount]; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters