user7425470
user7425470

Reputation: 905

Excel coordinate(s) with c#

I want an Array(not a list converted to an Array), to assign only 1 coordinate something like "A4" should be accessed like _excelCoordinate["A"][4], so I was thinking of a multidimensional array whith only one element(coordinate pair).

This is what I came up with:

private dynamic[,] _excelCoordinate;

_excelCoordinate = new[,] { { "" }, { 0 } };

But I get:

No best type found for implicitly-typed array

And maybe no extra class, for that data structure.

How should it look the correct way ?

Upvotes: 2

Views: 70

Answers (1)

Alex Wiese
Alex Wiese

Reputation: 8370

You need to specify the type of the array you are creating (in this case dynamic[,]). The compiler cannot infer what the type of the array should be based on the elements (the string and the integer) provided in the array initializer.

_excelCoordinate  = new dynamic[,] { { "" }, { 0 } };

Upvotes: 1

Related Questions