Link to home
Start Free TrialLog in
Avatar of brgdotnet
brgdotnetFlag for United States of America

asked on

ini file , create a key value pair where a key has multiple values

I am creating an ini file and realize that there are sections. Example given below. Each section contains key value pairs. If I want to assign multiple values to a key, how do I do that? Below is simple ini file I created. If I just want all of the names assigned to one variable like "P1", can I do that? I figure that
when I read the .ini file I can parse out each value if it is comma delimited, but I don't know if their is a format for such a construct of multiple values assigned to a key? For example should each value be seperated by a command and then entire string surrounded by curly braces?

ini file 1:
[Parent]

Also I don't see a section on experts exchange for ini files, so I chose .NET instead.
P1="Smith"
P2="Jones"
P3="Baker"

proposed ini file:
P1={"Smith","Jones","Baker"}
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

where is that INI file used?

Have a look at https://www.emoreau.com/Entries/Articles/2003/05/Applications-Settings-in-VBNet.aspx. Check for "Method 1". The downloadable example has an example of sections.
SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
alternatively, abandon the INI configuration and try use JSON or XML instead? which could be more structured and easier to read out the values
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial