tags:

views:

68

answers:

4

Is there a .NET version of GetPrivateProfileString?

(I can use p/invoke, I just don't want to unless necessary.)

+1  A: 

Not built in, no. There's nothing that can natively read and understand the layout of an .ini file in .NET. GetPrivateProfileString is your best bet.

David Morton
+1  A: 

No, there isn't, at least not in the Base Class Library. This isn't surprizing, given that .NET doesn't have any native support (in the form of pure managed code, or wrappers over P/Invoke calls) for INI files.

casperOne
A: 

Try nini

Benny
+1  A: 

If you dont want to use Interop, you can use ini file loader class like this one

http://www.codeproject.com/KB/recipes/INI_Files.aspx

Fadrian Sudaman
Not exactly what I had in mind, but definitely something to consider if I find myself keeping the ini files longer that I had planned.
Jonathan Allen