我正在研究UWP,我想在某个地方存储路径,我发现ApplicationData.LocalSettings可以这样做。
但是当我通过共享文件夹路径存储共享文件夹路径时出错了,因为*,我不知道为什么。有什么好的解决办法吗?下面是代码,非常简单:
var path = @"\\192.168.1.1\test";
ApplicationData.Current.LocalSettings.Values.Keys.Contains<string>(path);
ApplicationData.Current.LocalSettings.Values[path] = xxx;包含函数和add函数还抛出COMException
发布于 2021-07-26 02:08:05
UWP ApplicationData LocalSettings
我们可以重现这个问题,它看起来"\“char不支持但不支持"",对于这种情况,更好的方法是使用" path”字符串作为键来替换路径值- key。我会报告这个问题。
ApplicationData.Current.LocalSettings.Values"path“= xxxx;
或将头\\替换为空。
var path = @"192.168.1.1\test";发布于 2021-07-24 17:12:42
我试过你的密码了。LocalSettings不能将路径用作键,因为它包含*符号。
例如,
String path = @"&&192.168.1.1&test"; // I replaced every \ with &
ApplicationData.Current.LocalSettings.Values[path] = "your string";将正确保存your string。
https://stackoverflow.com/questions/68496786
复制相似问题