Xamarin.Android iterate Java.Util.HashMap

Viewed 2059

Anyone know the best way to iterate a Java HashMap in Xamarin.Android? According to the docs it appears doing a foreach on EntrySet is suppose to return an instance of IMapEntry on each iteration, but I get an invalid cast when doing:

foreach(Java.Util.IMapEntry entry in hashMap.EntrySet())

Or if you'd rather tell me how to convert the HashMap to a .Net dictionary that would be find too as it is my end goal.

Note: this is for Xamarin.Android specifically and it doesn't seem to be as straight forward as the suggested duplicate.

1 Answers
Related