G
G
Gangg2017-02-12 21:55:13
JSON
Gangg, 2017-02-12 21:55:13

How to iterate over a hashtable collection in C#?

I'm testing the ViKing.Engine library, it has a method for decoding json strings. It returns a hashtable. But here's the problem, I can't iterate through this collection through foreach. Writes Error The foreach statement does not work with variables of type "object", because "object" does not contain a public definition for "GetEnumerator"
I give a code screen
0c15f7c84a2e48f5acf62ef795603462.png
Please help me solve the problem.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Usotsky, 2017-02-12
@AquariusStar

If it returns a Hashtable, then according to the site https://professorweb.ru/my/csharp/charp_theory/lev... before that, you must first get a list of keys or values. Foreach cannot work with a pair - only with either keys or values.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question