SharpConfig配置文件操作組件
SharpConfig 是 .NET 的 CFG/INI 配置文件操作組件。可以使用 SharpConfig 以文本或二進(jìn)制格式讀取,修改和保存配置文件和流。
該庫與 .NET、.NET Core 和 Mono 框架完全兼容。
配置文件示例:
[General] # a comment SomeString = Hello World! SomeInteger = 10 # an inline comment SomeFloat = 20.05 ABoolean = true
C# 代碼:
Configuration config = Configuration.LoadFromFile( "sample.cfg" ); Section section = config["General"]; string someString = section["SomeString"].Value; int someInteger = section["SomeInteger"].GetValue<int>(); float someFloat = section["SomeFloat"].GetValue<float>();
評論
圖片
表情
