tomtom1923
March 1st, 2010, 10:19 AM
I am looking for a better method to read a properties file. My program loads and does a loop with some processing based on a properties file. The properties file can be changed on the fly to change how the loop runs or what processing is performed.
Here is what I do right now:
The config file has values like this:
source=c:\data\data.txt
string[] configProp = File.ReadAllLines(@"config.properties");
I load the file into a string array. I then proceed to reassign string array value into a new string and perform trims to remove the leader "source=" and I am left with "c:\data\data.txt" which is my usable variable.
This just seems like a lot of extra work, does anyone know of a better way to load a properties file?
Here is what I do right now:
The config file has values like this:
source=c:\data\data.txt
string[] configProp = File.ReadAllLines(@"config.properties");
I load the file into a string array. I then proceed to reassign string array value into a new string and perform trims to remove the leader "source=" and I am left with "c:\data\data.txt" which is my usable variable.
This just seems like a lot of extra work, does anyone know of a better way to load a properties file?