user6048670
user6048670

Reputation: 2887

Why am I getting "Expression denotes a `variable', where a `method group' was expected" here?

Can someone help me figure out why I'm getting that compiler error on the LINQ query below?

int[,] umap = /* initialize umap */;

int[][] surroundings = new int[][] {
    new int[] { x0 - 1, y0 }, new int[] { x0, y0 }, 
    new int[] {x0 + 1, y0}, new int[] { x0 - 1, y0 + 1}, 
    new int[] { x0, y0 + 1 }, new int[] {x0 + 1, y0 + 1},
    new int[] { x0 - 1, y0 - 1}, new int[] { x0, y0 - 1 }, 
    new int[] {x0 + 1, y0 - 1} 
};
var real = surroundings.Where(pair => pair[0] >= 0 && pair[0] < xN 
                                   && pair[1] >= 0 && pair[1] < yN
                                   && !umap(pair[0], pair[1]));

Upvotes: 0

Views: 3748

Answers (1)

user94559
user94559

Reputation: 60133

Change !umap(pair[0], pair[1]) to !umap[pair[0], pair[1]]

Per your comment above, it's a two-dimensional array, but you're trying to call it as though it's a method. To index into an array, use square brackets.

Upvotes: 1

Related Questions