.NET 的 CFG/INI 配置文件操作组件:SharpConfig
jopen
9年前
SharpConfig 是 .NET 的 CFG/INI 配置文件操作组件。
配置文件示例:
[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>();