How to get data from array sample code below
var AllData = new Dictionary<string, object>
{
{ "TestFun", await TestFun() },
};
var TestFun = AllData["TestFun"] // ok
ArrayList Humidity = (ArrayList)AllData["TestFun"]; // Error
String String1= TestFun["String1"] // ???
private static async Task<Dictionary<string, object>> TestFun() {
var MultiArray = new Dictionary<string, object>
{
{ "String1", "Value1"},
};
return MultiArray;
}
Error
System.InvalidCastException: 'Unable to cast object of type > 'System.Collections.Generic.Dictionary`2[System.String,System.Object]' to type > 'System.Collections.ArrayList'.'
Or
Cannot apply indexing with [] to an expression of type 'object'
Tried to get an answer here but couldn't find a solution...