jeudi 6 juillet 2017

Accessing dynamic object on the dispatcher

I'm currently running into a performance issue using a dynamic object in Silverlight. I am receiving some Json and converting it to a dynamic type like so.

jsonToken.ToObject<dynamic>();

Then later I am loading values from the object onto the GUI like so.

textBox.Text = JsonObject.Group.Property;

The issue is that if I load a bunch of properties this takes a long time and since its on the dispatcher everything hangs while its happening. It take 125ms per property, which is pretty significant. The second time its accessed its instant. I'm assume this is due to reflection and things being cached. Is there any way I can "preload" everything on a background thread? Is there a better way to do this? I would like to avoid creating classes for everything and parsing it that way.





Aucun commentaire:

Enregistrer un commentaire