There are many ways to store application initialization information in external files. Because Windows still supports the API calls to read and write standard INI files, do you think it's useful to translate INI files to XML? Would you rather have seen an article that discussed building a .NET custom configuration handler? Let us know in the vb.dotnet.technical newsgroup.
As you upgrade your .NET applications, upgrade those legacy INI files as well, and save yourself some headaches.
by A. Russell Jones, Ph.D.
October 21, 2002
he INI (application INItialization) file format became popular because it provided a convenient way to store values that might change (such as file locations, user preferences, etc.) in a standard format accessible to but outside of compiled application code. INI files are text-based, meaning you can read and change the values easily; logically arranged, meaningit is easy even for non-technical personnel to understand the contents; and the functions for reading and modifying the files were built into Windows.
In a recent featured discussion on DevX (see Use COM Interop to Read and Write to INI Files with .NET) I explained how to read and write INI files with .NET using DllImport to access the Windows API functions from within a C# or VB.NET class. Although the DllImport method lets you use existing INI files from .NET, it doesn't do anything to solve the problems inherent in the INI file format itselfand INI files have a number of deficiencies. For example, total file size is limited to 64Kb total, individual values cannot exceed 256 characters, and the Windows API provides no programmatic way to read and write comments. Translating the files to XML solves these problems.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!