Saturday, February 28, 2015

Deserialize to object

Hi!


I found the below code for how to deserialize data from a file. But the code only returns a string representing the data, not the original object. How can I get it to deserialize into the same object as it was serialized from?


Thanks, Sigurd F



string content = String.Empty;

var myStream = await ApplicationData.Current.LocalFolder.OpenStreamForReadAsync(JSONFILENAME);
using (StreamReader reader = new StreamReader(myStream))
{
content = await reader.ReadToEndAsync();
}
var obj = App.Current as App;
//obj.objectGraph = content;


No comments:

Post a Comment