我正在开发一个要在 Raspberry Pi 上运行的 UWP 应用程序。我需要读取 .ini 文件中存储的数据 - 我知道 Microsoft 希望我使用 xml,但我需要使用 ini。
我已成功使用 GetPrivateProfileString(如下: http://www.codeproject.com/Articles/1966/An-INI-file-handling-class-using-C )通过“标准”C# 项目从 ini 文件中读取值。
但是,这似乎不适用于 UWP C# 项目。我没有任何错误,只是如果我尝试使用 kernel32 函数读取或写入,什么也不会发生。
发生什么事了?是否仍然可以在 UWP 应用中使用这些功能?如果没有,我是否必须自己编写一个ini处理类?
最佳答案
MSDN说:
Note This function is provided only for compatibility with 16-bit Windows-based applications. Applications should store initialization information in the registry.
我假设该功能在您的目标平台上不可用。您必须自己读取并解析 INI 文件。
关于c# - 使用 kernel32.dll 中的 GetPrivateProfileString,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38498559/