Avatar of brgdotnet
brgdotnet
Flag 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"}
.NET Programming

Avatar of undefined
Last Comment
Gary Benjamin

8/22/2022 - Mon
Éric Moreau

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
AndyAinscow

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ryan Chong

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
Gary Benjamin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23