I'm working on a project on c#. I'm using templates for class name State, here's the code:
class State<T>
{
private T state; //so T could be string or Cell
}
and I want to initialize it with a class named Cell
public class Cell
{
int currentRow,currentColumn;
Char value;
public Cell()
{
this.currentRow = 4;
this.currentColumn = 7;
this.value='0';
}
}
Now I want a new State<Cell>
to be my initial State, saying:
public class Maze
{
public State<Cell> initialState;
public void CreateMaze(string name, int type) //creating maze
{
Board Maze = new Cell[size, size]; //board is matrix of cells
currentRow = random.Next(0, size);
currentCol = random.Next(0, size);
Maze[currentRow, currentCol].value = '*';
initialState = State<Maze[currentRow, currentCol]>;
}
}
gives me error "using the generic type requires one argument" help..?