#region 读Ini文件
///
/// 读取ini文件内容的方法
///
/// ini文件的节名
/// ini文件对应节下的健名
/// ini文件对应节对应健下无内容时返回的值
/// 该ini文件的路径
///
public static string ReadIniData(string Section, string Key, string NoText, string iniFilePath)
{
if (File.Exists(iniFilePath))
{
StringBuilder temp = new StringBuilder(1024);
GetPrivateProfileString(Section, Key, NoText, temp, 1024, iniFilePath);
return temp.ToString();
}
else
{
return String.Empty;
}
}
#endregion
我用这个把参数设置为null,能读取第一个sections,怎么样去循环其他的🥺🥺
ini文件类似字典一样
你要先知道里面都有什么,然后通过名字去读
而不是靠遍历了再判断名字叫什么
反正对于netcore来说,全部的provider都遵循基础抽象,读出来就是你要的东西,他读出来的是字典,所以你想啥循环遍历就谁便你
ps:即使你不是netcore,只要你是net4.62以上版本都可以用。和某园子把netcore和abp深度绑定不一样,真正的开发者只会认为这些东西并非abp专享也非netcore专享,任何使用net4.62以上的人,只要你愿意接受host体系,你就可以这样写这样用,并非需要去个所谓的abp站上弄一套abp.xxx出来