tags:

views:

96

answers:

5
+1  Q: 

IniFiles in .NET

What is the best way to read and write .INI files in .NET? It looks like I could write my own parser or use native Windows API calls but neither of those options are very appealing. Are there other options?

A: 

You can try this class.

Ariel
+2  A: 

I've used Nini in the past:

Nini

Justin Niessner
+1 for Nini - Even though the project seems to have died down, what's already available is very usable.
Amit G
A: 

I have used Nini in the past with success, the page seems to be broken at the moment however, soourceforge are having issues and that might be the cause.

EDIT: Beaten by 45 seconds, typical!

SteveL
+1  A: 

.Net uses an xml-based system for it's own configuration information. If you're looking to do this for configuration for your own program you should really go that route.

Because of this, Microsoft hasn't really seen the need to provide a built-in *.ini parser. If you need to support files for legacy apps it means you're down to reading the files from disk and parsing them manually. There are a number of different third-party options out there you could use to make this easier, but google will do a better job recommending one than I could.

Joel Coehoorn
A: 

here is a technique for using reflection and binding to an ini file:

http://dvuyka.spaces.live.com/blog/cns!305B02907E9BE19A!174.entry?wa=wsignin1.0&sa=372854585

quimbo