Answer the question
In order to leave comments, you need to log in
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
Please help me solve the problem.
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question