Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有以下代码
StorageFile sf = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("/data/elements.xml");
我正在尝试从我的项目中的数据文件夹加载 elements.xml 文件。我收到以下错误:
""值不在预期范围内。""
我尝试反转斜杠并在字符串前添加@。没运气。
如果elements.xml位于 Data 文件夹中,并且包含下面代码片段的类文件位于不同的文件夹中,例如 DataModel,则使用所示的字符串应该适合您。
elements.xml
var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync("Data\\\elements.xml");
抱歉,如果您想使用路径,请改用反斜杠。