{"id":665,"date":"2016-12-16T18:07:57","date_gmt":"2016-12-16T18:07:57","guid":{"rendered":"https:\/\/ibex.tech\/windows-iot\/?p=255"},"modified":"2022-09-13T15:38:52","modified_gmt":"2022-09-13T14:38:52","slug":"applicationdata-for-settings-scores-etc","status":"publish","type":"post","link":"https:\/\/ibex.tech\/csharp\/uwp-programming-in-c\/files\/applicationdata-for-settings-scores-etc","title":{"rendered":"ApplicationData For Settings, Scores, Etc"},"content":{"rendered":"<p>ApplicationDataContainer values can be: bool, byte, int, uint, long, ulong, float, double, or string<\/p>\n<pre><code>\nusing Windows.Storage;\n<\/code><\/pre>\n<h5>\n\tWrite Settings<\/h5>\n<pre><code>\n\t\/\/----- STORE APP SETTINGS -----\n\tApplicationDataContainer AppDataLocalSettings = ApplicationData.Current.LocalSettings;\n\n\tAppDataLocalSettings.Values[\"MyInt\"] = 5;\n\tAppDataLocalSettings.Values[\"MyBool\"] = true;\n\tAppDataLocalSettings.Values[\"MyString\"] = \"Hello\";\n<\/code><\/pre>\n<h5>\n\tRead Settings<\/h5>\n<p>Null is returned if setting does not exist<\/p>\n<pre><code>\n\t\/\/----- READ APP SETTINGS -----\n\tint SomeInt;\n\tbool SomeBool;\n\tstring SomeString;\n\tobject ReadValue;\n\n\tApplicationDataContainer AppDataLocalSettings = ApplicationData.Current.LocalSettings;\n\n\tReadValue = AppDataLocalSettings.Values[\"MyInt\"];\n\tif (ReadValue != null)\n\t\tSomeInt = (int)ReadValue;\n\n\tReadValue = AppDataLocalSettings.Values[\"MyBool\"];\n\tif (ReadValue != null)\n\t\tSomeBool = (bool)ReadValue;\n\n\tReadValue = AppDataLocalSettings.Values[\"MyString\"];\n\tif (ReadValue != null)\n\t\tSomeString = (string)ReadValue;\n<\/code><\/pre>\n<h5>\n\tDelete Settings<\/h5>\n<pre><code>\n\t\/\/----- DELETE AN APP SETTING -----\n\tApplicationDataContainer AppDataLocalSettings = ApplicationData.Current.LocalSettings;\n\tAppDataLocalSettings.Values.Remove(\"MyString\");\n<\/code><\/pre>\n<h4>\n\tUsage Notes<\/h4>\n<p>The name of each setting can be 255 characters in length at most. Each setting can be up to 8K bytes in size.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ApplicationDataContainer values can be: bool, byte, int, uint, long, ulong, float, double, or string using Windows.Storage; Write Settings \/\/&#8212;&#8211; STORE APP SETTINGS &#8212;&#8211; ApplicationDataContainer AppDataLocalSettings = ApplicationData.Current.LocalSettings; AppDataLocalSettings.Values[&#8220;MyInt&#8221;] = 5; AppDataLocalSettings.Values[&#8220;MyBool&#8221;] = true; AppDataLocalSettings.Values[&#8220;MyString&#8221;] = &#8220;Hello&#8221;; Read Settings Null is returned if setting does not exist \/\/&#8212;&#8211; READ APP SETTINGS &#8212;&#8211; int SomeInt; bool SomeBool; [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[135],"tags":[],"class_list":["post-665","post","type-post","status-publish","format-standard","hentry","category-files"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/comments?post=665"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/665\/revisions"}],"predecessor-version":[{"id":1185,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/posts\/665\/revisions\/1185"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/media?parent=665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/categories?post=665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/csharp\/wp-json\/wp\/v2\/tags?post=665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}