Reputation: 104
I'm programming in vb.net and I need to access information from an ini file. There is also some information that I need to insert into the ini file manually so that the program can access it. For example, I need an array Extensions
to contain a set of possible file extensions for my program to loop through. How do I manually insert this into an ini file (ie just typing, without using a program)? What is the syntax?
Upvotes: 1
Views: 3223
Reputation: 4381
There is no correct syntax for an array, you can place whatever you like as value.
So you could choose whatever syntax you want, for example: Extensions=.ex1,.ex2,.ex3
and in your code you would parse (for this example split) the INI key's value as you need.
The syntax I used was like the following: Extensions={.ex1,.ex2,.ex3}
Also I created an INI library that would enable me to easily manipulate with that value syntax.
For example:
Dim ini As New IniFile()
ini.Load("My Extensions.ini")
Dim extensions As String()
If ini.Sections(0).Keys("Extensions").TryParseValue(extensions) Then
For Each extension In extensions
Console.WriteLine(extension)
Next
End If
Upvotes: 1