P
P
Platon Stepanov2020-05-10 10:20:42
C++ / C#
Platon Stepanov, 2020-05-10 10:20:42

C# How to split a dictionary into an array of keys and an array of values?

There is a dictionary:

Dictionary<float, string> ObjectsOnSceneInDict = .....

It should be split into 2 arrays:
float[] DistanceToObjects = new float[360];
String[] TypeObjectsString = new String[360];

I tried a couple of options from the Internet, but did not find the answer.
Please help. Not a pro in C#...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-05-10
@StepanovPlaton

float[] DistanceToObjects = ObjectsOnSceneInDict.Keys.ToArray();
string[] TypeObjectsString = ObjectsOnSceneInDict.Values.ToArray();

But why?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question