Table of Contents

Method CloneStructure

Namespace
Gamelogic.Grids2
Assembly
Gamelogic.Grids2.dll

CloneStructure<TPoint, TNewCell>(IGrid<TPoint>, TNewCell)

Creates a grid with a new cell type, and set the value of each cell to the given initial value.

public static IGrid<TPoint, TNewCell> CloneStructure<TPoint, TNewCell>(this IGrid<TPoint> grid, TNewCell initialValue)

Parameters

grid IGrid<TPoint>

The grid to clone.

initialValue TNewCell

The value to assign to each cell in the grid.

Returns

IGrid<TPoint, TNewCell>

Type Parameters

TPoint

The point type of the given grid.

TNewCell

The type of resulting grid.

CloneStructure<TPoint, TNewCell>(IGrid<TPoint>, Func<TNewCell>)

Creates a grid with a new cell type, and set the value of each cell to the value return by a given function.

public static IGrid<TPoint, TNewCell> CloneStructure<TPoint, TNewCell>(this IGrid<TPoint> grid, Func<TNewCell> generateItem)

Parameters

grid IGrid<TPoint>

The grid to clone.

generateItem Func<TNewCell>

A function that returns a value. The function is called for each point in the grid.

Returns

IGrid<TPoint, TNewCell>

Type Parameters

TPoint

The point type of the grid.

TNewCell

The cell type of the resulting grid.

CloneStructure<TPoint, TNewCell>(IGrid<TPoint>, Func<TPoint, TNewCell>)

Creates a grid with a new cell type, and set the value of each cell to the value return by a given function.

public static IGrid<TPoint, TNewCell> CloneStructure<TPoint, TNewCell>(this IGrid<TPoint> grid, Func<TPoint, TNewCell> generateItem)

Parameters

grid IGrid<TPoint>

The grid to clone.

generateItem Func<TPoint, TNewCell>

A function that returns a value. The function is called for each point in the grid, and the point is passed as a parameter.

Returns

IGrid<TPoint, TNewCell>

Type Parameters

TPoint

The point type of the grid.

TNewCell

The cell type of the resulting grid.