P
pbd22
I am having a hard time figuring out how to expose (& loop through)
the properties of my Categories class which was serialized (using
JSON) in a WCF service and deserialized on the server as illustrated
below.
JavaScriptSerializer serializer = new JavaScriptSerializer();
Category cat = serializer.Deserialize<Category>(param1);
// Missing a cast here?
foreach (var c in cat)
{
ele.InnerHtml += String.Format("<option value={0}>{1} ></
option>",
c.field.id, c.field.path);
}
Where (I gather) I am going wrong is that I have to cast my Category
object as either ICollection or IEnumerable in order to access
GetEnumerator()? I think this is the step that I need advice on (if,
indeed, I am barking up the right tree?). I'd seriously appreciate
code examples in answers.
Thanks.
the properties of my Categories class which was serialized (using
JSON) in a WCF service and deserialized on the server as illustrated
below.
JavaScriptSerializer serializer = new JavaScriptSerializer();
Category cat = serializer.Deserialize<Category>(param1);
// Missing a cast here?
foreach (var c in cat)
{
ele.InnerHtml += String.Format("<option value={0}>{1} ></
option>",
c.field.id, c.field.path);
}
Where (I gather) I am going wrong is that I have to cast my Category
object as either ICollection or IEnumerable in order to access
GetEnumerator()? I think this is the step that I need advice on (if,
indeed, I am barking up the right tree?). I'd seriously appreciate
code examples in answers.
Thanks.