Skip to content

INI files

vijaya.nutakki

Asked Sep 28, 2003, 10:22 PM EDT5 answers
Share
LinkedInX
How can we access the information of the INI files in C#? Are there any built-in functions?

5 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    No. INI files are very much a "Windows-ism" and are deprecated. There is not intrinsic support for them. However, there are several 3rd party libraries to handle them. A google search should net you several results, but freeware and commercial. XML config files are the wave of the future.
    0
  • Mahesh Chand
    0
    That's right. You should use XML files.
    0
  • 0
    PS... you still have options. You can write a C#/VB.NET wrapper around the Windows API INI file functions, or take an existing C++/VB6 library (which again, are readily available all over the 'net) and wrap that up with C# or VB.NET, etc. But given a choice, as Manesh says... you'll want to use XML files or even your own custom format and break away from the Windows-specific models where possible. .NET won't ever be fully platform independent until we... THE DEVELOPERS... demand it.
    0
  • 0
    API Calls [DllImport("kernel32")] private static extern long WritePrivateProfileString(string section, string key,string val,string filePath); [DllImport("kernel32")] private static extern int GetPrivateProfileString(string section, string key,string def, StringBuilder retVal, int size,string filePath);
    0