I have - var JsonObj = []; and I pushed some data into that and send it to codebehind using JQuery.ajax() method. I am able to receive in a method which has parameter like this
[WebMethod]
public static void SaveInfo(List<Object> userEnteredDetails)
{
}
And i loop thru the collection to get the data something like this,
foreach (object item in userEnteredDetails)
{
Dictionary<string, object> details = item as Dictionary<string, object>;
string name = details["customerName"] as string;
}
The problem here is, I am receiving more than 10 items in the collecton. So i cannot read another property in my above for loop. Something like this,
foreach (object item in userEnteredDetails)
{
Dictionary<string, object> details = item as Dictionary<string, object>;
string name = details["customerName"] as string;
string city= details["city"] as string;
}
Firsttime city wil throw an error, and next time customername. Because item variable will have one variable at a time. How to read all the more than 10 records efficiently since we dont have property, but can read only through an indexer (details["customerName"]).
objectinstead of a custom strong-typed DTO like Person, Employee etc?