Free Code Snippets in C#, Net Framework, Office 365, ASP.Net,WPF, Visual Studio, SQL Server, Antivirus free
#

UWP: Problem with settings with special characters BackSlash

 

 

When you use the LocalSettings for Windows apps can you cache very simple values of the current application.

In principle, this works like a small mini database consisting of key name and the associated values.

The data are in the app settings under Windows.Storage.ApplicationDataContainerSettings stored

 

But beware: when you use the key labels special characters should be avoided.

 

If you would like to store values under the Keybezeichnung path special characters such as a backslash, then this can be not found in the collection.

 

An example: you want to store the value v2011 under the key ["B:\\2011"] then, although no error comes up, but this value is not found in the collection of values

ApplicationData.Current.LocalSettings.Containers ["EntryPoints"]. Values["B:\\2011"]="v2011"; ]

 

The naming of keys without special characters leads to the success

ApplicationData.Current.LocalSettings.Containers ["EntryPoints"]. Values [' B: 2011 "] ="v2011";

"v2011"

 

You can impersonate the value to values in a foreach loop of container. And here you can see that a pair of values is missing.

Result

System.Collections.Generic.KeyValuePair < string, object >

+ [0] {[A, vA]}

+ [1] {[B: 2011 v2011]}

+ [2] {[B, vB]}

+ [3] {[02.04.2016 18:05:45, F:\DCIM\100OLYMP]}

 

 

Problem: Control

Querying the values like GetSetting works however. Apparently the values but still be saved but are not find storage (collection) in the value

Read the setting values will quarl as shown here

var varReturn = ApplicationData . Current.LocalSettings.Containers [sContainer_Name]. Values [sSettingName],

 

 

 

 

Direct input in c#

ApplicationData.Current.LocalSettings.Containers ["EntryPoints"]. Values["B:\\2011"]="v2011"; ]

"v2011"

ApplicationData.Current.LocalSettings.Containers ["EntryPoints"]. Values [' B: 2011 "] ="v2011";

"v2011"

 

 

 

Result

System.Collections.Generic.KeyValuePair < string, object >

+ [0] {[A, vA]}

+ [1] {[B: 2011 v2011]}

+ [2] {[B, vB]}

+ [3] {[02.04.2016 18:05:45, F:\DCIM\100OLYMP]}

 

-(ApplicationData.Current.LocalSettings.Containers ["EntryPoints"]). Values, results

{Windows.Storage.ApplicationDataContainerSettings}

Windows.Foundation.Collections.IPropertySet {Windows.Storage.ApplicationDataContainerSettings}

 

 

As a hard copy in the debugger.

As you can see, the collection of values, only without the backslash variants will spend in the container.

 

UWP Windows universal platform app

 

 

 

 

 

Mobile
»
Settings: Save List Array in Settings
»
UWP Error: Date variable Error operation to serialize the value to be written
»
UWP: delete all settings, settings of a Windows app with ClearAsync
»
UWP: Value of setting
»
UWP: Application settings, number and size
»
UWP: Problem with settings with special characters BackSlash

.

Contact for Jobs, Project Requests: raimund.popp@microsoft-programmierer.de