c# - localSettings.Containers[containername] - The given key was not present -
i looping through code looking localsettings. when container null gives error message "the given key not present in dictionary". how can check see container null doesn't crash code?
if ((windows.storage.applicationdatacontainer)localsettings.containers[containername] != null)
this gives same error
var container = localsettings.containers[containername];
windows.storage.applicationdatacontainer settings = windows.storage.applicationdata.current.localsettings; //this checks if given container name exists or not if(settings.containers.containskey("containername")) { if(settings.containers["containername"].values.containskey("your data key")) { //do } }
hope helps
Nice article. This article is very useful informative .waiting for more update Learn Manual Testing Online
ReplyDeleteManual Testing Certification Online
Great blog. Thanks for sharing such a useful information. Share more.
ReplyDeletePytest Online Training And Certification
Pytest Online Certification