この状況での私の好みは、適切なリレーショナルな方法で配置された構成データの DataTables を使用して DataSet を作成し、DataSet.WriteXML() を使用して構成ファイルに保存することです。
その後、再度ロードするには、DataSet.ReadXML() を使用するだけで、クエリ可能なオブジェクトに戻ります。
これは、私のアプリでユーザーがテキスト エディター ウィンドウで編集できる構成ファイルの例です。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!--****************************************************************
Config File: FileToExcel_test.cfg
Author: Ron Savage
Date: 06/20/2008
Description:
File to test parsing a file into an Excel workbook.
Modification History:
Date Init Comment
06/20/2008 RS Created.
******************************************************************-->
<!--********************************************************************
Global Key Definitions
********************************************************************-->
<config key="sqlTimeout" value="1800"/>
<config key="emailSMTPServer" value="smtp-server.austin.rr.com"/>
<config key="LogFile" value="FiletoExcel_test_{yyyy}{mm}{hh}.log"/>
<config key="MaxEntries" value="1"/>
<!--********************************************************************
Delimiter Configurations
********************************************************************-->
<config key="pipe" value="|"/>
<!--********************************************************************
Source / Target Entries
********************************************************************-->
<config key="source_1" value="FILE, c:\inetpub\ftproot\filetoexcel.txt, pipe, , , , , "/>
<config key="target_1" value="XLS, REPLACE, c:\inetpub\ftproot\filetoexcel1.xls, , , , , , , ,c:\inetpub\ftproot\filetoexcel_template.xls, ,3"/>
<config key="notify_1" value="store_error, store_success"/>
</configuration>
それを DataSet にロードすると、コメント以外のタグはすべて、フィールドKey & valueを持つConfigという名前のテーブルに存在します。非常に簡単に検索できます。