Mono says int is List <dynamic>
I am trying to convert .NET code to Mono. Everything works fine except for this part:

As you can see, valueint. Mono says int List<dynamic>(look at the value b). Then, the if statement goes to the else if part and then throws an exception on line 129, because int cannot be sent to List. In .NET else, if the part is correctly evaluated as false. Can someone help please?
Here you can copy the code :)
public static StringBuilder JsonValueToString(dynamic value, StringBuilder sb)
{
if (value is JsonObject)
{
return value.BuildString(sb);
}
else if (value is List<dynamic>)
{
var xs = (List<dynamic>) value;
sb.Append("[");
for (int i = 0; i < xs.Count; ++i)
{
if (i > 0) sb.Append(", ");
JsonValueToString(xs[i], sb);
}
sb.Append("]");
}
else
{
sb.Append(value.ToString());
sb.Append(" ");
}
return sb;
}
// EDIT: added a better image.
// EDIT2: code snippet added.
+4
1 answer