Reputation: 559
So, I've been googling a bit now, and I can't seem to locate my error...
I'm simply getting an error
"error CS0119: Expression denotes a value
, where a method group
was expected"
Can someone help me locate the error? I'd usually think I missed a "new", but that doesn't seem to be the case.
[Serializable]
public class Map {
public Cell[,] cells;
public ushort width, height;
private Map() {
}
public Map(ushort w, ushort h) {
width = w;
height = h;
cells = new Cell[width, height](); //The error is located right here.
}
}
Upvotes: 0
Views: 7643
Reputation: 77926
Error is in the last line as pointed below; remove the ()
cells = new Cell[width, height]();
<--Here
Upvotes: 0
Reputation: 149628
Initialize the multi-dimensional array without using parenthesis:
cells = new Cell[width, height];
Upvotes: 3