c# - How to store a Dictionary<string,object> inside a Container in Windows 8 Metro app? -
i windows phone developer.. started development windows 8 metro style apps. trying figure out basics storing user data. tried storing dictionary of type dictionary inside container. when try exception saying data of type cannot stored! doing wrong? code looks this:
this storage manager class:
applicationdatacontainer localsettings = applicationdata.current.localsettings; storagefolder storagefolder = applicationdata.current.localfolder; public bool savetostorage(string containername, string key, object datatostore) { try { if (!localsettings.containers.containskey(containername)) { localsettings.createcontainer(containername, applicationdatacreatedisposition.always); } localsettings.containers[containername].values.add(key, datatostore); return true; } catch (exception ex) { return false; } }
this how passing dictionary
dictionary<string, object> profiledict = new dictionary<string, object>(); profiledict.add(utilities.firstname, txtboxfname.text); profiledict.add(utilities.lastname, txtboxlname.text); profiledict.add(utilities.email, txtboxemail.text); savetostorage(utilities.mymedicalprofilecontainer, utilities.myprofile, profiledict);
can please me out this.. doing wrong?? , suggestions appreciated!
why isn't isolated storage dll available same?
you can use xml serialization. applicationdata.current.localsettings
doesn't support data types. there libs available provide feature similar isolated storage. use xml serialization.
Comments
Post a Comment