E
E
Envywewok2019-04-29 12:01:57
.NET
Envywewok, 2019-04-29 12:01:57

Can a two-dimensional array int[,] be a Dictionary value in C#?

Such a task. There are files containing 1.4 lyama values ​​in the form of a two-dimensional array 1201x1201. Files with a specific type name - N02E128 (this is longitude and latitude).
The essence of the program will be that they set a square on the map with coordinates and it should load into memory all files suitable for the given coordinates, and I will check by deserialized coordinates from the file name.
Well, I decided that the dictionary is suitable to make the names the keys and store these arrays by the keys. But it looks like it can't store a 2D array as a value.
I'm also happy to hear other suggestions on how to store it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Envywewok, 2019-05-22
@Envywewok

there was a typo, store - maybe.

D
Dmitriyq, 2019-04-29
@Dmitriyq

You can push a tuple into a dictionary
Or describe the class itself, for example

public struct Coordinate {
  public double Longitude { get; set; }
  public double Latitude { get; set; }
}
public class MapPart {
  public string Name { get; set; }
  public ICollection<Coordinate> Coordinates { get; set; }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question